diff --git a/libtransmission/crypto-test.c b/libtransmission/crypto-test.c index e914241b6..7d357c874 100644 --- a/libtransmission/crypto-test.c +++ b/libtransmission/crypto-test.c @@ -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); diff --git a/libtransmission/crypto.c b/libtransmission/crypto.c index 86aacf7b7..a85e1e616 100644 --- a/libtransmission/crypto.c +++ b/libtransmission/crypto.c @@ -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