Skip to content

Commit dc6e2c7

Browse files
authored
reporter: Fix io.EOF handling (#3010)
The way the if statement was written, if there is an io.EOF error, then we still first try reading the response object, however, in the io.EOF case it's null, therefore the if statement needs to be swapped around so it would never try to read something on the nil pointer if an io.EOF error is returned.
2 parents 0ea54ad + 36d35f7 commit dc6e2c7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

reporter/parca_reporter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ func (r *ParcaReporter) reportDataToBackend(ctx context.Context, buf *bytes.Buff
617617
if err != nil && err != io.EOF {
618618
return err
619619
}
620-
if len(resp.Record) == 0 || err == io.EOF {
620+
if err == io.EOF || len(resp.Record) == 0 {
621621
// The backend didn't want any more information.
622622
return nil
623623
}

0 commit comments

Comments
 (0)