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