File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -217,6 +217,9 @@ func (decoder *fuzzyIntegerDecoder) Decode(ptr unsafe.Pointer, iter *jsoniter.It
217
217
default :
218
218
iter .ReportError ("fuzzyIntegerDecoder" , "not number or string" )
219
219
}
220
+ if len (str ) == 0 {
221
+ str = "0"
222
+ }
220
223
newIter := iter .Pool ().BorrowIterator ([]byte (str ))
221
224
defer iter .Pool ().ReturnIterator (newIter )
222
225
isFloat := strings .IndexByte (str , '.' ) != - 1
Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ func Test_any_to_int64(t *testing.T) {
37
37
should .Equal (int64 (10 ), val )
38
38
should .Nil (jsoniter .UnmarshalFromString (`10` , & val ))
39
39
should .Equal (int64 (10 ), val )
40
+ should .Nil (jsoniter .UnmarshalFromString (`""` , & val ))
41
+ should .Equal (int64 (0 ), val )
40
42
41
43
// bool part
42
44
should .Nil (jsoniter .UnmarshalFromString (`false` , & val ))
You can’t perform that action at this time.
0 commit comments