Skip to content

Commit

Permalink
cmd/ingest: fix nil pointer deref
Browse files Browse the repository at this point in the history
When the previous block returns an error, ingestRes may be nil, which
caused a panic.

Signed-off-by: Tomás Senart <[email protected]>
  • Loading branch information
tsenart authored and lukasmalkmus committed Aug 30, 2023
1 parent 2d5cdac commit 81b964d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/cmd/ingest/ingest.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,11 @@ func run(ctx context.Context, opts *options, flushEverySet bool) error {
} else {
ingestRes, err = ingestReader(ctx, client, r, typ, opts)
}
res.Add(ingestRes)

// Error handling below, so we need to check for nil.
if ingestRes != nil {
res.Add(ingestRes)
}

if err != nil && !errors.Is(err, context.Canceled) {
_ = rc.Close()
Expand Down

0 comments on commit 81b964d

Please sign in to comment.