Skip to content

Commit

Permalink
be careful handling pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
mash committed Jul 31, 2024
1 parent 05d865c commit 15f38d4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions firequeue.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ func (q *Queue) attemptToSendBatch(batch []*firehose.Record) error {
return nil
}
// Retry failed records.
if resp != nil && *resp.FailedPutCount > 0 {
if resp != nil && resp.FailedPutCount != nil && *resp.FailedPutCount > 0 {
q.successCount.Add(int64(len(batch)) - int64(*resp.FailedPutCount))
q.retryFailedRecords(batch, resp)
return nil
Expand All @@ -320,7 +320,7 @@ func (q *Queue) retryFailedRecords(batch []*firehose.Record, resp *firehose.PutR
retryRecords := make([]*firehose.Record, 0, *resp.FailedPutCount)

for i, record := range batch {
if resp.RequestResponses[i].ErrorCode != nil {
if resp.RequestResponses != nil && resp.RequestResponses[i] != nil && resp.RequestResponses[i].ErrorCode != nil {
q.retryCount.Add(1)
retryRecords = append(retryRecords, record)
}
Expand Down

0 comments on commit 15f38d4

Please sign in to comment.