From 4aa3540f0be29f7db73d2c18dd1f91e514ead490 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Thu, 30 Nov 2017 10:35:54 +0000 Subject: Fixed never-ending run when analyzing only a single SNP, ref https://groups.google.com/forum/#!topic/gemma-discussion/a-ommTiucC8 --- src/io.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/io.cpp') diff --git a/src/io.cpp b/src/io.cpp index fb0f0e7..7e682b3 100644 --- a/src/io.cpp +++ b/src/io.cpp @@ -52,10 +52,17 @@ using namespace std; // Print progress bar. void ProgressBar(string str, double p, double total, double ratio) { assert(p<=total); + assert(p>=0); + if (total <= 0.0) return; const double progress = (100.0 * p / total); const uint barsize = (int)(progress / 2.0); // characters - cout << str << " "; - cout << std::string(barsize,'='); + // cout << barsize << endl; + // cout << str << " "; + // cout << p << "/" << total << endl; + assert(barsize < 101); // corrupted data somehow + if (barsize > 0) { + cout << std::string(barsize,'='); + } cout << std::string(50-barsize,' '); cout << setprecision(0) << fixed << " " << progress << "%"; if (ratio != -1.0) -- cgit v1.2.3