Commit 52769342 authored by Vitaly Lipatov's avatar Vitaly Lipatov

uni_atoi: return 0 if char pointer is NULL

parent 497200a3
...@@ -208,11 +208,13 @@ namespace UniSetTypes ...@@ -208,11 +208,13 @@ namespace UniSetTypes
/// ( 0x, 16-) /// ( 0x, 16-)
inline int uni_atoi( const char* str ) inline int uni_atoi( const char* str )
{ {
if ( str == NULL)
return 0;
if (strlen(str) < 3 || toupper(str[1]) != 'X') if (strlen(str) < 3 || toupper(str[1]) != 'X')
return std::atoi(str); return std::atoi(str);
unsigned int n; unsigned int n;
std::sscanf(str,"%x",&n); std::sscanf(str,"%x",&n);
return n; return n;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment