summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2015-06-03 19:56:12 -0400
committerirungentoo <irungentoo@gmail.com>2015-06-03 19:56:12 -0400
commit6d883f488ff59b2394982b62895d50b1d1d55bf4 (patch)
treea6aab7693626323627e957266f8f3ea29e4b284b
parent8f346b46175cc603f15c47f783c3b9544f920f84 (diff)
Return error if file_id parameter is NULL.
-rw-r--r--other/apidsl/tox.in.h1
-rw-r--r--toxcore/tox.c5
-rw-r--r--toxcore/tox.h5
3 files changed, 11 insertions, 0 deletions
diff --git a/other/apidsl/tox.in.h b/other/apidsl/tox.in.h
index fc66dfac..30c78e44 100644
--- a/other/apidsl/tox.in.h
+++ b/other/apidsl/tox.in.h
@@ -1651,6 +1651,7 @@ namespace file {
1651 1651
1652 1652
1653 error for get { 1653 error for get {
1654 NULL,
1654 /** 1655 /**
1655 * The friend_number passed did not designate a valid friend. 1656 * The friend_number passed did not designate a valid friend.
1656 */ 1657 */
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
1011bool tox_file_get_file_id(const Tox *tox, uint32_t friend_number, uint32_t file_number, uint8_t *file_id, 1011bool 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,