Fixed crash with invalid group invite numbers.

This commit is contained in:
Håvard Pettersson 2014-10-10 11:36:54 +02:00
parent 2f288cfb49
commit 68cb3cc543
2 changed files with 8 additions and 3 deletions

View File

@ -90,9 +90,14 @@ twc_group_chat_invite_remove(struct t_twc_group_chat_invite *invite)
*/
struct t_twc_group_chat_invite *
twc_group_chat_invite_with_index(struct t_twc_profile *profile,
int64_t index)
size_t index)
{
return twc_list_get(profile->group_chat_invites, index)->group_chat_invite;
struct t_twc_list_item *item =
twc_list_get(profile->group_chat_invites, index);
if (item)
return item->group_chat_invite;
else
return NULL;
}
/**

View File

@ -52,7 +52,7 @@ twc_group_chat_invite_remove(struct t_twc_group_chat_invite *invite);
struct t_twc_group_chat_invite *
twc_group_chat_invite_with_index(struct t_twc_profile *profile,
int64_t index);
size_t index);
void
twc_group_chat_invite_free(struct t_twc_group_chat_invite *invite);