From 39ce280236c3eb6303bc3db1784cabf8e518e3e5 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 6 Jun 2015 13:18:26 +0300 Subject: Fix atox with empty input string. --- src/utils/stringutils.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') 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) -- cgit v1.2.3-70-g09d2