diff options
author | luigi1111 <luigi1111w@gmail.com> | 2018-05-31 14:36:33 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2018-05-31 14:36:33 -0500 |
commit | c8378933aecd4598e41732de90b99c62d59ea928 (patch) | |
tree | cf7e955e4d8bfbc77005eda17b88468944639f46 /src/blockchain_utilities | |
parent | Merge pull request #3489 (diff) | |
parent | blockchain_usage: don't divide by 0 when there is nothing to process (diff) | |
download | monero-c8378933aecd4598e41732de90b99c62d59ea928.tar.xz |
Merge pull request #3543
6fc97c9 blockchain_usage: don't divide by 0 when there is nothing to process (moneromooo-monero)
Diffstat (limited to 'src/blockchain_utilities')
-rw-r--r-- | src/blockchain_utilities/blockchain_usage.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/blockchain_utilities/blockchain_usage.cpp b/src/blockchain_utilities/blockchain_usage.cpp index b78f3591b..38a0b2648 100644 --- a/src/blockchain_utilities/blockchain_usage.cpp +++ b/src/blockchain_utilities/blockchain_usage.cpp @@ -243,10 +243,17 @@ int main(int argc, char* argv[]) counts[out.second.size()]++; total++; } - for (const auto &c: counts) + if (total > 0) { - float percent = 100.f * c.second / total; - MINFO(std::to_string(c.second) << " outputs used " << c.first << " times (" << percent << "%)"); + for (const auto &c: counts) + { + float percent = 100.f * c.second / total; + MINFO(std::to_string(c.second) << " outputs used " << c.first << " times (" << percent << "%)"); + } + } + else + { + MINFO("No outputs to process"); } LOG_PRINT_L0("Blockchain usage exported OK"); |