From 39991b7bf47bf2ecd99fcdd7cbc5048155b19ee5 Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 17 Nov 2010 19:13:39 +0000 Subject: [PATCH] suppressed possible SIGFPE git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3811 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libbitdht/src/bitdht/bdpeer.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libbitdht/src/bitdht/bdpeer.cc b/libbitdht/src/bitdht/bdpeer.cc index 5abba60f7..1a586ed86 100644 --- a/libbitdht/src/bitdht/bdpeer.cc +++ b/libbitdht/src/bitdht/bdpeer.cc @@ -978,6 +978,10 @@ bool bdSpace::findRandomPeerWithFlag(bdId &id, uint32_t withFlag) { std::vector::iterator it; uint32_t totalcount = calcSpaceSizeWithFlag(withFlag); + + if(totalcount == 0) + return false ; + uint32_t rnd = rand() % totalcount; uint32_t i = 0; uint32_t buck = 0;