1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-26 06:28:30 +02:00

Fix is_number() accepting "-" as a number

The function would accept the string "-" as a number, when it isn't one.

To fix this, don't put it as part of the loop, just add another special
case.
This commit is contained in:
Misa 2021-02-11 21:44:33 -08:00 committed by Ethan Lee
parent 28caa994e9
commit 3225be6d9e

View File

@ -272,6 +272,11 @@ bool is_number(const char* str)
return false;
}
if (str[0] == '-' && str[1] == '\0')
{
return false;
}
for (size_t i = 1; str[i] != '\0'; ++i)
{
if (!SDL_isdigit(str[i]))