Skip to content

Commit

Permalink
Fix potential panic when subscribing to topic fails (#830)
Browse files Browse the repository at this point in the history
Avoid referencing subscription when constructing an error message as it
may be nil when subscription fails.
  • Loading branch information
masih authored Jan 16, 2025
1 parent d3d8077 commit 935bafa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion host.go
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ func (h *gpbftRunner) startPubsub() (<-chan gpbft.ValidatedMessage, error) {
)
sub, err := h.topic.Subscribe(pubsub.WithBufferSize(subBufferSize))
if err != nil {
return nil, fmt.Errorf("could not subscribe to pubsub topic: %s: %w", sub.Topic(), err)
return nil, fmt.Errorf("could not subscribe to pubsub topic: %s: %w", h.topic, err)
}

messageQueue := make(chan gpbft.ValidatedMessage, msgQueueBufferSize)
Expand Down

0 comments on commit 935bafa

Please sign in to comment.