francoispqt / gojay

high performance JSON encoder/decoder with stream API for Golang
MIT License
2.11k stars 112 forks source link

Update cursor after null correctly #48

Closed lorenzo-stoakes closed 6 years ago

lorenzo-stoakes commented 6 years ago

I noticed some errors on parsing object data and this patch seems correct. Do let me know if I am making some incorrect assumptions here! And thanks v. much for a nice library :)

For a number of types of field value contained within an object, a null value would result in errors of the form:

Invalid JSON, wrong char 'l' found at position xx

This appears to be due to the cursor not consistently being updated after the null value is detected.

This patch resolves the issue by consistently updating the cursor in each case.

codecov-io commented 6 years ago

Codecov Report

Merging #48 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #48   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          30     30           
  Lines        3529   3537    +8     
=====================================
+ Hits         3529   3537    +8
Impacted Files Coverage Δ
decode_number_float.go 100% <100%> (ø) :arrow_up:
decode_number_int.go 100% <100%> (ø) :arrow_up:
decode_number_uint.go 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f324ba0...ca28f10. Read the comment docs.

francoispqt commented 6 years ago

You're right. Thanks for spotting this. merging.