diff options
author | irungentoo <irungentoo@gmail.com> | 2015-06-03 19:56:12 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2015-06-03 19:56:12 -0400 |
commit | 6d883f488ff59b2394982b62895d50b1d1d55bf4 (patch) | |
tree | a6aab7693626323627e957266f8f3ea29e4b284b /toxcore | |
parent | 8f346b46175cc603f15c47f783c3b9544f920f84 (diff) |
Return error if file_id parameter is NULL.
Diffstat (limited to 'toxcore')
-rw-r--r-- | toxcore/tox.c | 5 | ||||
-rw-r--r-- | toxcore/tox.h | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/toxcore/tox.c b/toxcore/tox.c index d3b021aa..3e9db766 100644 --- a/toxcore/tox.c +++ b/toxcore/tox.c | |||
@@ -1011,6 +1011,11 @@ void tox_callback_file_recv_control(Tox *tox, tox_file_recv_control_cb *function | |||
1011 | bool tox_file_get_file_id(const Tox *tox, uint32_t friend_number, uint32_t file_number, uint8_t *file_id, | 1011 | bool tox_file_get_file_id(const Tox *tox, uint32_t friend_number, uint32_t file_number, uint8_t *file_id, |
1012 | TOX_ERR_FILE_GET *error) | 1012 | TOX_ERR_FILE_GET *error) |
1013 | { | 1013 | { |
1014 | if (!file_id) { | ||
1015 | SET_ERROR_PARAMETER(error, TOX_ERR_FILE_GET_NULL); | ||
1016 | return 0; | ||
1017 | } | ||
1018 | |||
1014 | const Messenger *m = tox; | 1019 | const Messenger *m = tox; |
1015 | int ret = file_get_id(m, friend_number, file_number, file_id); | 1020 | int ret = file_get_id(m, friend_number, file_number, file_id); |
1016 | 1021 | ||
diff --git a/toxcore/tox.h b/toxcore/tox.h index e5158915..14c9f616 100644 --- a/toxcore/tox.h +++ b/toxcore/tox.h | |||
@@ -1781,6 +1781,11 @@ typedef enum TOX_ERR_FILE_GET { | |||
1781 | TOX_ERR_FILE_GET_OK, | 1781 | TOX_ERR_FILE_GET_OK, |
1782 | 1782 | ||
1783 | /** | 1783 | /** |
1784 | * One of the arguments to the function was NULL when it was not expected. | ||
1785 | */ | ||
1786 | TOX_ERR_FILE_GET_NULL, | ||
1787 | |||
1788 | /** | ||
1784 | * The friend_number passed did not designate a valid friend. | 1789 | * The friend_number passed did not designate a valid friend. |
1785 | */ | 1790 | */ |
1786 | TOX_ERR_FILE_GET_FRIEND_NOT_FOUND, | 1791 | TOX_ERR_FILE_GET_FRIEND_NOT_FOUND, |