From 4bb7f61e31c71be0e6a26331da8f66c4ff17daa6 Mon Sep 17 00:00:00 2001 From: Jordan Lee Date: Sun, 18 May 2014 20:47:58 +0000 Subject: [PATCH] fix tr_cryptoGetTorrentHash() behavior for crypto-test.c --- libtransmission/crypto-test.c | 4 ---- libtransmission/crypto.c | 3 +-- 2 files changed, 1 insertion(+), 6 deletions(-) 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