From 7838973ef3fd9c04459efd038ffbe969f491a574 Mon Sep 17 00:00:00 2001 From: Jman012 Date: Wed, 19 Feb 2014 09:31:29 -0800 Subject: [PATCH] Fixed the groupchat bug in a smarter way. --- toxcore/group_chats.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/toxcore/group_chats.c b/toxcore/group_chats.c index b610e9a5..1ec8ede5 100644 --- a/toxcore/group_chats.c +++ b/toxcore/group_chats.c @@ -787,7 +787,10 @@ static void del_dead_peers(Group_Chat *chat) delpeer(chat, i); } - if (chat->group != NULL && chat->group[i].deleted) { + if (chat->group == NULL || i >= chat->numpeers) + break; + + if (chat->group[i].deleted) { if (is_timeout(chat->group[i].deleted_time, DEL_PEER_DELAY)) delpeer(chat, i); }