mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-08 18:09:45 +01: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:
parent
28caa994e9
commit
3225be6d9e
1 changed files with 5 additions and 0 deletions
|
@ -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]))
|
||||
|
|
Loading…
Reference in a new issue