You've already forked json-iterator
mirror of
https://github.com/json-iterator/go.git
synced 2025-07-03 23:30:41 +02:00
#135 fix double negative
This commit is contained in:
@ -159,6 +159,14 @@ func (iter *Iterator) readFloat32SlowPath() (ret float32) {
|
||||
if iter.Error != nil && iter.Error != io.EOF {
|
||||
return
|
||||
}
|
||||
if len(str) == 0 {
|
||||
iter.ReportError("readFloat32SlowPath", "empty number")
|
||||
return
|
||||
}
|
||||
if str[0] == '-' {
|
||||
iter.ReportError("readFloat32SlowPath", "-- is not valid")
|
||||
return
|
||||
}
|
||||
val, err := strconv.ParseFloat(str, 32)
|
||||
if err != nil {
|
||||
iter.Error = err
|
||||
@ -233,6 +241,14 @@ func (iter *Iterator) readFloat64SlowPath() (ret float64) {
|
||||
if iter.Error != nil && iter.Error != io.EOF {
|
||||
return
|
||||
}
|
||||
if len(str) == 0 {
|
||||
iter.ReportError("readFloat64SlowPath", "empty number")
|
||||
return
|
||||
}
|
||||
if str[0] == '-' {
|
||||
iter.ReportError("readFloat64SlowPath", "-- is not valid")
|
||||
return
|
||||
}
|
||||
val, err := strconv.ParseFloat(str, 64)
|
||||
if err != nil {
|
||||
iter.Error = err
|
||||
|
Reference in New Issue
Block a user