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/blockchain_usage.cpp | |
| parent | 3a373c3d3ae9837b4002247f25efcb6325950dd4 (diff) | |
| parent | 6fc97c97ebfe2a82b90f1b69dbe1ed84bf51f1ac (diff) | |
| download | monzero-core-c8378933aecd4598e41732de90b99c62d59ea928.tar.gz monzero-core-c8378933aecd4598e41732de90b99c62d59ea928.tar.xz monzero-core-c8378933aecd4598e41732de90b99c62d59ea928.zip | |
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/blockchain_usage.cpp')
| -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"); |
