From c021a655ddd2a031cf971a3bf8534febd616da6b Mon Sep 17 00:00:00 2001 From: Markus Date: Sun, 1 Sep 2019 10:32:11 +0200 Subject: [PATCH] fix error: 0 is No number --- parameterManager.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/parameterManager.cpp b/parameterManager.cpp index 05aaab7..f1a77fb 100644 --- a/parameterManager.cpp +++ b/parameterManager.cpp @@ -939,12 +939,16 @@ bool nothingExists(std::string path) bool isNumber(std::string number) { - for (size_t i = 0; i < number.length(); ++i) { + bool hasRemovedZero = false; + for (size_t i = 0; i < number.length(); ++i) if( number[i] == '0') { number.erase(i, 1); i--; + hasRemovedZero=true; } - } + if(hasRemovedZero && number == "") + number="0"; + return (std::to_string(atoll(number.c_str())) == number) ? true : false; }