1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 01:00:25 +00:00

exp_parser:: crash on unknown values starting with capital letters and _

This commit is contained in:
Zeno Rogue 2021-07-31 11:56:31 +02:00
parent da4429e327
commit ebfe0b6f48

View File

@ -340,6 +340,8 @@ cld exp_parser::parse(int prio) {
else if(number == "mousez") res = cld(mousex - current_display->xcenter, mousey - current_display->ycenter) / cld(current_display->radius, 0);
else if(number == "shot") res = inHighQual ? 1 : 0;
else if(number[0] >= 'a' && number[0] <= 'z') throw hr_parse_exception("unknown value: " + number);
else if(number[0] >= 'A' && number[0] <= 'Z') throw hr_parse_exception("unknown value: " + number);
else if(number[0] == '_') throw hr_parse_exception("unknown value: " + number);
else { std::stringstream ss; res = 0; ss << number; ss >> res; }
}
while(true) {