guard empty str in isNumber

This commit is contained in:
Vaxry 2022-11-11 14:04:35 +00:00
parent 13befbd266
commit 61995e3b4e

View file

@ -251,6 +251,8 @@ std::deque<std::string> splitArgs(int argc, char** argv) {
}
bool isNumber(const std::string& str, bool allowfloat) {
if (str.empty())
return false;
return std::ranges::all_of(str.begin(), str.end(), [&](char c) { return isdigit(c) != 0 || c == '-' || (allowfloat && c == '.'); });
}