pfrd: fix mod by zero error when all branches are filtered

This commit is contained in:
Antonio SJ Musumeci
2021-06-25 09:15:44 -04:00
parent bcd5fde5d8
commit c06db9c3a0
3 changed files with 9 additions and 0 deletions
+3
View File
@@ -204,6 +204,9 @@ namespace eppfrd
uint64_t idx;
uint64_t threshold;
if(sum_ == 0)
return NULL;
idx = 0;
threshold = RND::rand64(sum_);
for(size_t i = 0; i < branchinfo_.size(); i++)
+3
View File
@@ -130,6 +130,9 @@ namespace msppfrd
uint64_t idx;
uint64_t threshold;
if(sum_ == 0)
return NULL;
idx = 0;
threshold = RND::rand64(sum_);
for(size_t i = 0; i < branchinfo_.size(); i++)
+3
View File
@@ -98,6 +98,9 @@ namespace pfrd
uint64_t idx;
uint64_t threshold;
if(sum_ == 0)
return NULL;
idx = 0;
threshold = RND::rand64(sum_);
for(size_t i = 0; i < branchinfo_.size(); i++)