1
0
Fork 0
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:
Misa 2021-02-11 16:37:39 -08:00 committed by Ethan Lee
parent 89bddf98b6
commit b9bf2be436

View file

@ -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)