summaryrefslogtreecommitdiffstats
path: root/src/StringUtils.h
diff options
context:
space:
mode:
authorlinnemannr <linnemannr@gmail.com>2015-05-30 10:23:57 +0200
committerlinnemannr <linnemannr@gmail.com>2015-05-30 10:23:57 +0200
commitee34e7131a5a7a308fe431c44741d68a10bb2625 (patch)
tree8f72bc78944f08e0287bf9c782c8152a138a6489 /src/StringUtils.h
parentMerge pull request #2166 from SafwatHalaby/squid (diff)
downloadcuberite-ee34e7131a5a7a308fe431c44741d68a10bb2625.tar
cuberite-ee34e7131a5a7a308fe431c44741d68a10bb2625.tar.gz
cuberite-ee34e7131a5a7a308fe431c44741d68a10bb2625.tar.bz2
cuberite-ee34e7131a5a7a308fe431c44741d68a10bb2625.tar.lz
cuberite-ee34e7131a5a7a308fe431c44741d68a10bb2625.tar.xz
cuberite-ee34e7131a5a7a308fe431c44741d68a10bb2625.tar.zst
cuberite-ee34e7131a5a7a308fe431c44741d68a10bb2625.zip
Diffstat (limited to '')
-rw-r--r--src/StringUtils.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/StringUtils.h b/src/StringUtils.h
index 8f67d8031..62767d007 100644
--- a/src/StringUtils.h
+++ b/src/StringUtils.h
@@ -168,6 +168,12 @@ bool StringToInteger(const AString & a_str, T & a_Num)
}
else
{
+ // Unsigned result cannot be signed!
+ if (!std::numeric_limits<T>::is_signed)
+ {
+ return false;
+ }
+
for (size_t size = a_str.size(); i < size; i++)
{
if ((a_str[i] < '0') || (a_str[i] > '9'))