tox_hash fix.

This commit is contained in:
irungentoo 2015-04-09 09:50:24 -04:00
parent c3a6c5b92e
commit 3c87c84223
No known key found for this signature in database
GPG Key ID: 10349DC9BED89E98
2 changed files with 3 additions and 3 deletions

View File

@ -851,7 +851,7 @@ void tox_callback_friend_message(Tox *tox, tox_friend_message_cb *function, void
bool tox_hash(uint8_t *hash, const uint8_t *data, size_t length)
{
if (!hash || !data) {
if (!hash || (length && !data)) {
return 0;
}

View File

@ -1418,8 +1418,8 @@ enum TOX_FILE_KIND {
* primarily for validating cached avatars. This use is highly recommended to
* avoid unnecessary avatar updates.
*
* If length is zero or data is NULL, the hash will contain all zero. If hash is
* NULL, the function returns false, otherwise it returns true.
* If hash is NULL or data is NULL while length is not 0 the function returns false,
* otherwise it returns true.
*
* This function is a wrapper to internal message-digest functions.
*