Skip to content

Commit 48febcf

Browse files
committed
stringFloat
Signed-off-by: James Cherry <cherry@parallaxsw.com>
1 parent 53a1552 commit 48febcf

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

util/StringUtil.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ stringFloat(const std::string &str)
6767
return {0.0, false};
6868
#else
6969
char *ptr;
70+
errno = 0;
7071
value = strtof(str.data(), &ptr);
71-
if (!errno || *ptr != '\0')
72+
if (errno != 0 || *ptr != '\0')
7273
return {0.0, false};
7374
else
7475
return {value, true};

0 commit comments

Comments
 (0)