mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Avoid passing -1 as friend connection to new groups.
Somehow it still works because the lower levels can deal with inconsistent/broken state, but this lets us avoid that broken state in the first place. If a friend connection doesn't exist, we don't add it to our group.
This commit is contained in:
parent
c10d5ceeee
commit
b77e407b6f
|
@ -1492,7 +1492,13 @@ static void handle_friend_invite_packet(Messenger *m, uint32_t friendnumber, con
|
|||
memcpy(&other_groupnum, data + 1, sizeof(uint16_t));
|
||||
other_groupnum = net_ntohs(other_groupnum);
|
||||
|
||||
int friendcon_id = getfriendcon_id(m, friendnumber);
|
||||
const int friendcon_id = getfriendcon_id(m, friendnumber);
|
||||
|
||||
if (friendcon_id == -1) {
|
||||
// TODO(iphydf): Log something?
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t real_pk[CRYPTO_PUBLIC_KEY_SIZE], temp_pk[CRYPTO_PUBLIC_KEY_SIZE];
|
||||
get_friendcon_public_keys(real_pk, temp_pk, g_c->fr_c, friendcon_id);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user