From bdb00322e3ecb9eb213ce01688089cdad39304f0 Mon Sep 17 00:00:00 2001 From: irungentoo Date: Sat, 5 Jul 2014 12:46:58 -0400 Subject: Fixed bug when loading friends list already containing an added friend. --- toxcore/Messenger.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'toxcore/Messenger.c') diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 4344fdcb..2adbd870 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c @@ -2598,6 +2598,10 @@ static int friends_list_load(Messenger *m, const uint8_t *data, uint32_t length) if (temp.status >= 3) { int fnum = m_addfriend_norequest(m, temp.client_id); + + if (fnum < 0) + continue; + setfriendname(m, fnum, temp.name, ntohs(temp.name_length)); set_friend_statusmessage(m, fnum, temp.statusmessage, ntohs(temp.statusmessage_length)); set_friend_userstatus(m, fnum, temp.userstatus); -- cgit v1.2.3 From d8406db1133a66d9183c2eade9e4fe0f9f22dd73 Mon Sep 17 00:00:00 2001 From: Jfreegman Date: Sat, 5 Jul 2014 19:47:13 -0400 Subject: delete groupchat when join fails --- toxcore/Messenger.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'toxcore/Messenger.c') diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 2adbd870..b65f09ae 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c @@ -1206,8 +1206,10 @@ int join_groupchat(Messenger *m, int32_t friendnumber, const uint8_t *friend_gro IP_Port friend_ip = get_friend_ipport(m, friendnumber); - if (friend_ip.ip.family == 0) + if (friend_ip.ip.family == 0) { + del_groupchat(m, groupnum); return -1; + } id_copy(data, friend_group_public_key); id_copy(data + crypto_box_PUBLICKEYBYTES, m->chats[groupnum]->self_public_key); @@ -1218,6 +1220,7 @@ int join_groupchat(Messenger *m, int32_t friendnumber, const uint8_t *friend_gro return groupnum; } + del_groupchat(m, groupnum); return -1; } -- cgit v1.2.3