Added null check to each chat before incrementing.

This commit is contained in:
Jman012 2013-11-19 11:44:26 -08:00
parent 21e514572c
commit 478d799ee3

View File

@ -2184,8 +2184,10 @@ uint32_t count_chatlist(Messenger *m)
uint32_t i;
for (i = 0; i < m->numchats; i++) {
if (m->chats[i]) {
ret++;
}
}
return ret;
}
@ -2212,9 +2214,11 @@ uint32_t copy_chatlist(Messenger *m, int *out_list, uint32_t list_size)
break; /* Abandon ship */
}
if (m->chats[i]) {
out_list[i] = i;
ret++;
}
}
return ret;
}