mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Fixed bug with deleting friends.
This commit is contained in:
parent
4864cb9edb
commit
f27b5c9296
|
@ -776,8 +776,11 @@ int DHT_delfriend(uint8_t * client_id)
|
||||||
{
|
{
|
||||||
if(memcmp(friends_list[i].client_id, client_id, CLIENT_ID_SIZE) == 0)//Equal
|
if(memcmp(friends_list[i].client_id, client_id, CLIENT_ID_SIZE) == 0)//Equal
|
||||||
{
|
{
|
||||||
memcpy(friends_list[num_friends].client_id, friends_list[i].client_id, CLIENT_ID_SIZE);
|
|
||||||
num_friends--;
|
num_friends--;
|
||||||
|
if(num_friends != i)
|
||||||
|
{
|
||||||
|
memcpy(friends_list[i].client_id, friends_list[num_friends].client_id, CLIENT_ID_SIZE);
|
||||||
|
}
|
||||||
temp = realloc(friends_list, sizeof(friends_list) * (num_friends));
|
temp = realloc(friends_list, sizeof(friends_list) * (num_friends));
|
||||||
if(temp != NULL)
|
if(temp != NULL)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user