Browse Source

Util: Fix Parser number error detection

master
Riyyi 2 years ago
parent
commit
5d844554f5
  1. 2
      src/util/json/parser.cpp

2
src/util/json/parser.cpp

@ -211,6 +211,7 @@ Value Parser::getNumber()
} }
} }
if (fractionPosition != 0 || exponentPosition != 0) {
if (fractionPosition == exponentPosition - 1) { if (fractionPosition == exponentPosition - 1) {
reportError(token, "invalid exponent sign, expected number"); reportError(token, "invalid exponent sign, expected number");
return nullptr; return nullptr;
@ -220,6 +221,7 @@ Value Parser::getNumber()
reportError(token, "invalid number"); reportError(token, "invalid number");
return nullptr; return nullptr;
} }
}
return std::stod(token.symbol); return std::stod(token.symbol);
} }

Loading…
Cancel
Save