]> granicus.if.org Git - transmission/commitdiff
fix tr_cryptoGetTorrentHash() behavior for crypto-test.c 2.83
authorJordan Lee <jordan@transmissionbt.com>
Sun, 18 May 2014 20:47:58 +0000 (20:47 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Sun, 18 May 2014 20:47:58 +0000 (20:47 +0000)
libtransmission/crypto-test.c
libtransmission/crypto.c

index e914241b6cd568952984711089627495e40fd4c4..7d357c87402c231810535454b1ed781ceaa49f29 100644 (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);
 
index 86aacf7b762f65a85e575b128893fcc790aadcf5..a85e1e616bb1aa045078fc275be091cd6b078386 100644 (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