]> git.mxchange.org Git - simgear.git/commitdiff
Don't parse a single "e" or "E" as a numerical zero. You need a
authorandy <andy>
Tue, 22 Mar 2005 20:28:47 +0000 (20:28 +0000)
committerandy <andy>
Tue, 22 Mar 2005 20:28:47 +0000 (20:28 +0000)
numerical prefix to use the 1.0e12 notation, "e" alone is not enough.

simgear/nasal/string.c

index 9da446f4027806075e5d0319508878a2a918690b..69aa473a42ca614513ab0c62137822d41d2d2299 100644 (file)
@@ -199,6 +199,9 @@ static int tonum(unsigned char* s, int len, double* result)
         i += fraclen;
     }
 
+    // Nothing so far?  Then the parse failed.
+    if(i == 0) return 0;
+
     // Read the exponent, if any
     if(i < len && (s[i] == 'e' || s[i] == 'E'))
         i = readsigned(s, len, i+1, &exp);