aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-03-06 15:21:20 +0000
committergingerBill <bill@gingerbill.org>2023-03-06 15:21:20 +0000
commitfad330acd1ef2ffbf139ca1f52e93e3b367cf46f (patch)
treef7f96e46b0cafb1a8717cd679c8dcaceecb0ea0a
parent8f1af2630d2996a110cac1688b4ca89f4dfc3184 (diff)
Fix bug with nil pointer
-rw-r--r--core/strconv/strconv.odin7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/strconv/strconv.odin b/core/strconv/strconv.odin
index 5c96f584c..dc3d7dbf1 100644
--- a/core/strconv/strconv.odin
+++ b/core/strconv/strconv.odin
@@ -559,10 +559,12 @@ parse_f32 :: proc(s: string, n: ^int = nil) -> (value: f32, ok: bool) {
parse_f64 :: proc(str: string, n: ^int = nil) -> (value: f64, ok: bool) {
- value, n^, ok = parse_f64_prefix(str)
- if ok && len(str) != n^ {
+ nr: int
+ value, nr, ok = parse_f64_prefix(str)
+ if ok && len(str) != nr {
ok = false
}
+ if n != nil { n^ = nr }
return
}
@@ -760,7 +762,6 @@ parse_f64_prefix :: proc(str: string) -> (value: f64, nr: int, ok: bool) {
if mantissa != 0 {
exp = decimal_point - nd_mant
}
- // TODO(bill): check underscore correctness
ok = true
return
}