diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-06-06 13:18:26 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-06-06 13:18:26 +0300 |
commit | 39ce280236c3eb6303bc3db1784cabf8e518e3e5 (patch) | |
tree | 8ae685f013abf9e11119a1ffe8e3e82586096d43 /src/utils/stringutils.cpp | |
parent | 2bd59adc7c456ce6f377feac8bc838e8011ebfc8 (diff) | |
download | manaplus-39ce280236c3eb6303bc3db1784cabf8e518e3e5.tar.gz manaplus-39ce280236c3eb6303bc3db1784cabf8e518e3e5.tar.bz2 manaplus-39ce280236c3eb6303bc3db1784cabf8e518e3e5.tar.xz manaplus-39ce280236c3eb6303bc3db1784cabf8e518e3e5.zip |
Fix atox with empty input string.
Diffstat (limited to 'src/utils/stringutils.cpp')
-rw-r--r-- | src/utils/stringutils.cpp | 8 |
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) |