mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 17:38:16 +03: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:
@@ -272,6 +272,11 @@ bool is_number(const char* str)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (str[0] == '-' && str[1] == '\0')
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (size_t i = 1; str[i] != '\0'; ++i)
|
for (size_t i = 1; str[i] != '\0'; ++i)
|
||||||
{
|
{
|
||||||
if (!SDL_isdigit(str[i]))
|
if (!SDL_isdigit(str[i]))
|
||||||
|
|||||||
Reference in New Issue
Block a user