diff options
Diffstat (limited to 'source/core/slang-string-util.cpp')
| -rw-r--r-- | source/core/slang-string-util.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/core/slang-string-util.cpp b/source/core/slang-string-util.cpp index a6a18d4a0..c7625e1e0 100644 --- a/source/core/slang-string-util.cpp +++ b/source/core/slang-string-util.cpp @@ -727,6 +727,12 @@ int StringUtil::parseIntAndAdvancePos(UnownedStringSlice text, Index& pos) pos++; continue; } + bool isNeg = false; + if (pos < text.getLength() && text[pos] == '-') + { + pos++; + isNeg = true; + } while (pos < text.getLength()) { if (text[pos] >= '0' && text[pos] <= '9') @@ -740,6 +746,8 @@ int StringUtil::parseIntAndAdvancePos(UnownedStringSlice text, Index& pos) break; } } + if (isNeg) + result = -result; return result; } |
