Skip to content

Commit

Permalink
claim.Messages() seems returning nil sometime, avoid nil pointer (#865)
Browse files Browse the repository at this point in the history
claim.Messages() seems returning nil sometime, avoid nil pointer

Signed-off-by: nbajaj90 <nbajaj90@gmail.com>
  • Loading branch information
nbajaj90 authored Mar 15, 2023
1 parent e9e303c commit 581f868
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion protocol/kafka_sarama/v2/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ func (r *Receiver) ConsumeClaim(session sarama.ConsumerGroupSession, claim saram
// https://github.com/Shopify/sarama/blob/main/consumer_group.go#L27-L29
for {
select {
case msg := <-claim.Messages():
case msg, ok := <-claim.Messages():
if !ok {
return nil
}
m := NewMessageFromConsumerMessage(msg)

r.incoming <- msgErr{
Expand Down

0 comments on commit 581f868

Please sign in to comment.