mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 01:59:43 +01:00
Fix is_positive_num() returning true for empty strings
To account for empty strings, we simply have to special-case them. Simple as that. This was also a problem with the previous std::string implementation of this function; regardless, this is fixed now.
This commit is contained in:
parent
89bddf98b6
commit
b9bf2be436
1 changed files with 5 additions and 0 deletions
|
@ -286,6 +286,11 @@ static bool VVV_isxdigit(const unsigned char digit)
|
|||
|
||||
bool is_positive_num(const char* str, const bool hex)
|
||||
{
|
||||
if (str[0] == '\0')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (size_t i = 0; str[i] != '\0'; ++i)
|
||||
{
|
||||
if (hex)
|
||||
|
|
Loading…
Reference in a new issue