Return error if file_id parameter is NULL.

This commit is contained in:
irungentoo 2015-06-03 19:56:12 -04:00
parent 8f346b4617
commit 6d883f488f
No known key found for this signature in database
GPG Key ID: 10349DC9BED89E98
3 changed files with 11 additions and 0 deletions

View File

@ -1651,6 +1651,7 @@ namespace file {
error for get {
NULL,
/**
* The friend_number passed did not designate a valid friend.
*/

View File

@ -1011,6 +1011,11 @@ void tox_callback_file_recv_control(Tox *tox, tox_file_recv_control_cb *function
bool tox_file_get_file_id(const Tox *tox, uint32_t friend_number, uint32_t file_number, uint8_t *file_id,
TOX_ERR_FILE_GET *error)
{
if (!file_id) {
SET_ERROR_PARAMETER(error, TOX_ERR_FILE_GET_NULL);
return 0;
}
const Messenger *m = tox;
int ret = file_get_id(m, friend_number, file_number, file_id);

View File

@ -1780,6 +1780,11 @@ typedef enum TOX_ERR_FILE_GET {
*/
TOX_ERR_FILE_GET_OK,
/**
* One of the arguments to the function was NULL when it was not expected.
*/
TOX_ERR_FILE_GET_NULL,
/**
* The friend_number passed did not designate a valid friend.
*/