summaryrefslogtreecommitdiff
path: root/src/utils/stringutils.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-06-06 13:18:26 +0300
committerAndrei Karas <akaras@inbox.ru>2015-06-06 13:18:26 +0300
commit39ce280236c3eb6303bc3db1784cabf8e518e3e5 (patch)
tree8ae685f013abf9e11119a1ffe8e3e82586096d43 /src/utils/stringutils.cpp
parent2bd59adc7c456ce6f377feac8bc838e8011ebfc8 (diff)
downloadManaVerse-39ce280236c3eb6303bc3db1784cabf8e518e3e5.tar.gz
ManaVerse-39ce280236c3eb6303bc3db1784cabf8e518e3e5.tar.bz2
ManaVerse-39ce280236c3eb6303bc3db1784cabf8e518e3e5.tar.xz
ManaVerse-39ce280236c3eb6303bc3db1784cabf8e518e3e5.zip
Fix atox with empty input string.
Diffstat (limited to 'src/utils/stringutils.cpp')
-rw-r--r--src/utils/stringutils.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index 7ad144331..b6251a378 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -66,10 +66,10 @@ std::string &toUpper(std::string &str)
unsigned int atox(const std::string &str)
{
- unsigned int value;
- sscanf(str.c_str(), "0x%06x", &value);
-
- return value;
+ unsigned int value = 0;
+ if (sscanf(str.c_str(), "0x%06x", &value))
+ return value;
+ return 0;
}
const char *ipToString(const uint32_t address)