Additional error handling.

This commit is contained in:
Håvard Pettersson 2015-08-26 20:02:36 +02:00
parent b376432f04
commit 919ffee4d0
5 changed files with 100 additions and 32 deletions

View file

@ -68,11 +68,15 @@ twc_completion_friend(void *data,
uint8_t tox_id[TOX_PUBLIC_KEY_SIZE];
char hex_id[TOX_PUBLIC_KEY_SIZE * 2 + 1];
tox_friend_get_public_key(profile->tox, friend_numbers[i], tox_id, NULL); // do error handling
twc_bin2hex(tox_id, TOX_PUBLIC_KEY_SIZE, hex_id);
TOX_ERR_FRIEND_GET_PUBLIC_KEY err;
tox_friend_get_public_key(profile->tox, friend_numbers[i], tox_id, &err);
if (err == TOX_ERR_FRIEND_GET_PUBLIC_KEY_OK)
{
twc_bin2hex(tox_id, TOX_PUBLIC_KEY_SIZE, hex_id);
weechat_hook_completion_list_add(completion, hex_id, 0,
WEECHAT_LIST_POS_SORT);
weechat_hook_completion_list_add(completion, hex_id, 0,
WEECHAT_LIST_POS_SORT);
}
}
if (flags & TWC_COMPLETE_FRIEND_NAME)