fix tr_cryptoGetTorrentHash() behavior for crypto-test.c

This commit is contained in:
Jordan Lee 2014-05-18 20:47:58 +00:00
parent b44f9a19de
commit 4bb7f61e31
2 changed files with 1 additions and 6 deletions

View File

@ -29,9 +29,7 @@ test_torrent_hash (void)
tr_cryptoConstruct (&a, NULL, true);
check (!tr_cryptoHasTorrentHash (&a));
#ifdef NDEBUG
check (tr_cryptoGetTorrentHash (&a) == NULL);
#endif
tr_cryptoSetTorrentHash (&a, hash);
check (tr_cryptoHasTorrentHash (&a));
@ -51,9 +49,7 @@ test_torrent_hash (void)
tr_cryptoSetTorrentHash (&a, NULL);
check (!tr_cryptoHasTorrentHash (&a));
#ifdef NDEBUG
check (tr_cryptoGetTorrentHash (&a) == NULL);
#endif
tr_cryptoDestruct (&a);

View File

@ -282,9 +282,8 @@ const uint8_t*
tr_cryptoGetTorrentHash (const tr_crypto * crypto)
{
assert (crypto);
assert (crypto->torrentHashIsSet);
return crypto->torrentHash;
return crypto->torrentHashIsSet ? crypto->torrentHash : NULL;
}
int