summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toxcore/group_chats.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/toxcore/group_chats.c b/toxcore/group_chats.c
index 8c3fe210..d1782c71 100644
--- a/toxcore/group_chats.c
+++ b/toxcore/group_chats.c
@@ -290,6 +290,11 @@ static void setnick(Group_Chat *chat, int peernum, uint8_t *contents, uint16_t c
290 if (contents_len > MAX_NICK_BYTES || contents_len == 0) 290 if (contents_len > MAX_NICK_BYTES || contents_len == 0)
291 return; 291 return;
292 292
293 /* same name as already stored? */
294 if ((chat->group[peernum].nick_len == contents_len) &&
295 !memcmp(chat->group[peernum].nick, contents, contents_len))
296 return;
297
293 memcpy(chat->group[peernum].nick, contents, contents_len); 298 memcpy(chat->group[peernum].nick, contents, contents_len);
294 /* Force null termination */ 299 /* Force null termination */
295 chat->group[peernum].nick[contents_len - 1] = 0; 300 chat->group[peernum].nick[contents_len - 1] = 0;