Skip to content

Commit

Permalink
Merge pull request #12 from natureglobal/fix-panic
Browse files Browse the repository at this point in the history
be careful handling pointers
  • Loading branch information
mash authored Jul 31, 2024
2 parents 47356b1 + 15f38d4 commit b26ff23
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 @@ -306,7 +306,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 @@ -322,7 +322,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 b26ff23

Please sign in to comment.