fix unconditional access

This commit is contained in:
Green Sky 2025-01-07 20:51:32 +01:00
parent 353a8199ae
commit 8ad10978b9
No known key found for this signature in database

View File

@ -196,7 +196,17 @@ Contact3Handle ToxContactModel2::getContactFriend(uint32_t friend_number) {
} }
if (!_cr.all_of<Contact::Components::FirstSeen>(c)) { if (!_cr.all_of<Contact::Components::FirstSeen>(c)) {
_cr.emplace_or_replace<Contact::Components::FirstSeen>(c, std::min(_cr.get<Contact::Components::LastSeen>(c).ts, ts)); if (_cr.all_of<Contact::Components::LastSeen>(c)) {
_cr.emplace_or_replace<Contact::Components::FirstSeen>(c,
std::min(
_cr.get<Contact::Components::LastSeen>(c).ts,
ts
)
);
} else {
// TODO: did we?
_cr.emplace_or_replace<Contact::Components::FirstSeen>(c, ts);
}
} }
std::cout << "TCM2: created friend contact " << friend_number << "\n"; std::cout << "TCM2: created friend contact " << friend_number << "\n";