add case for empty strings in isNumber

This commit is contained in:
vaxerski 2022-09-30 21:54:13 +01:00
parent 7579e03b64
commit e6c9e3f81d
1 changed files with 3 additions and 0 deletions

View File

@ -175,6 +175,9 @@ bool isNumber(const std::string& str, bool allowfloat) {
if (*copy.begin() == '-')
copy = copy.substr(1);
if (copy.empty())
return false;
bool point = !allowfloat;
for (auto& c : copy) {
if (c == '.') {