mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-02 20:58:15 +00:00
Fix bug with nil pointer
This commit is contained in:
@@ -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) {
|
parse_f64 :: proc(str: string, n: ^int = nil) -> (value: f64, ok: bool) {
|
||||||
value, n^, ok = parse_f64_prefix(str)
|
nr: int
|
||||||
if ok && len(str) != n^ {
|
value, nr, ok = parse_f64_prefix(str)
|
||||||
|
if ok && len(str) != nr {
|
||||||
ok = false
|
ok = false
|
||||||
}
|
}
|
||||||
|
if n != nil { n^ = nr }
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -760,7 +762,6 @@ parse_f64_prefix :: proc(str: string) -> (value: f64, nr: int, ok: bool) {
|
|||||||
if mantissa != 0 {
|
if mantissa != 0 {
|
||||||
exp = decimal_point - nd_mant
|
exp = decimal_point - nd_mant
|
||||||
}
|
}
|
||||||
// TODO(bill): check underscore correctness
|
|
||||||
ok = true
|
ok = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user