-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jsonblob: check for error in Next #1181
base: main
Are you sure you want to change the base?
Conversation
a55fd48
to
ba2afe9
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1181 +/- ##
==========================================
- Coverage 52.23% 52.19% -0.05%
==========================================
Files 221 221
Lines 16878 16881 +3
==========================================
- Hits 8817 8811 -6
- Misses 7252 7259 +7
- Partials 809 811 +2 ☔ View full report in Codecov by Sentry. |
@@ -103,6 +103,9 @@ func (l *Loader) Next() bool { | |||
} | |||
} | |||
} | |||
if l.Err() != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this may not be completely correct. This allows EOF to still return true
which is probably ok, but only if l.next != nil
, I think. When l.next = nil
and l.err == io.EOF
, this returns true
, but will still cause a panic because l.e
will, therefore, be nil
, which is never expected when Next
returns true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By my thinking, the error check on the first entry should catch this?
Signed-off-by: RTann <[email protected]>
ba2afe9
to
b55b68d
Compare
After I thought #1180 would fix the panic I ran into, it turns out it's still there. I believe this is the culprit.
Next
does the following loop:After the loop, it is assumed
l.err == nil
, but that's not necessarily true. It's possibleDecode
returns a non-nil error, which should makeNext
returnfalse
.