From b9bf2be436b4d21468c77af23804095d42e243f3 Mon Sep 17 00:00:00 2001 From: Misa Date: Thu, 11 Feb 2021 16:37:39 -0800 Subject: [PATCH] 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. --- desktop_version/src/UtilityClass.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/desktop_version/src/UtilityClass.cpp b/desktop_version/src/UtilityClass.cpp index e46bec3f..12d2304d 100644 --- a/desktop_version/src/UtilityClass.cpp +++ b/desktop_version/src/UtilityClass.cpp @@ -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)