summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Src/StringUtil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/Common/Src/StringUtil.cpp')
-rw-r--r--Source/Core/Common/Src/StringUtil.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/Core/Common/Src/StringUtil.cpp b/Source/Core/Common/Src/StringUtil.cpp
index 4df2c4c05e..001f6f51ee 100644
--- a/Source/Core/Common/Src/StringUtil.cpp
+++ b/Source/Core/Common/Src/StringUtil.cpp
@@ -240,6 +240,13 @@ bool TryParseInt(const char* str, int* outVal)
{
const char* s = str;
int value = 0;
+ bool negativ = false;
+
+ if (*s == '-')
+ {
+ negativ = true;
+ s++;
+ }
while (*s)
{
@@ -252,6 +259,8 @@ bool TryParseInt(const char* str, int* outVal)
value = value * 10 + (c - '0');
}
+ if (negativ)
+ value = -value;
*outVal = value;
return(true);