Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(storage): fix nil check in gRPC Reader (#5376)
GetObjectChecksums() can return nil if no checksums are present,
so we need to check for nil.
  • Loading branch information
tritone committed Jan 19, 2022
1 parent 132b660 commit 5e7d722
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions storage/reader.go
Expand Up @@ -541,8 +541,8 @@ func (o *ObjectHandle) newRangeReaderWithGRPC(ctx context.Context, offset, lengt
}

// Only support checksums when reading an entire object, not a range.
if msg.GetObjectChecksums().Crc32C != nil && offset == 0 && length == 0 {
r.wantCRC = msg.GetObjectChecksums().GetCrc32C()
if checksums := msg.GetObjectChecksums(); checksums != nil && checksums.Crc32C != nil && offset == 0 && length == 0 {
r.wantCRC = checksums.GetCrc32C()
r.checkCRC = true
}

Expand Down

0 comments on commit 5e7d722

Please sign in to comment.