src/str.cc

changeset 79
2425fa6a4f21
parent 75
bf8c57437231
child 82
841562f5a32f
--- a/src/str.cc	Fri Jan 17 21:42:02 2014 +0200
+++ b/src/str.cc	Fri Jan 17 22:55:13 2014 +0200
@@ -246,7 +246,10 @@
     errno = 0;
     char* endptr;
     long i = strtol (m_string.c_str(), &endptr, base);
-    *ok = (errno == 0 && *endptr == '\0');
+
+	if (ok)
+		*ok = (errno == 0 && *endptr == '\0');
+
     return i;
 }
 
@@ -257,7 +260,10 @@
     errno = 0;
     char* endptr;
     float i = strtof (m_string.c_str(), &endptr);
-    *ok = (errno == 0 && *endptr == '\0');
+
+	if (ok)
+		*ok = (errno == 0 && *endptr == '\0');
+
     return i;
 }
 
@@ -268,7 +274,10 @@
     errno = 0;
     char* endptr;
     double i = strtod (m_string.c_str(), &endptr);
-    *ok = (errno == 0 && *endptr == '\0');
+
+	if (ok)
+		*ok = (errno == 0 && *endptr == '\0');
+
     return i;
 }
 

mercurial