Skip to content

Commit

Permalink
broker: prevent panic by checking for nil on channel close
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasjarosch committed Jul 21, 2020
1 parent 87aa2d4 commit 5a7c27f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion broker/amqp/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ func (c *Connection) WaitForConnection() {
func (c *Connection) Shutdown() {
c.setConnected(false)
c.cancel()
_ = c.channel.Close()
if c.channel != nil {
_ = c.channel.Close()
}

if c.IsConnected() {
err := c.conn.Close()
Expand Down

0 comments on commit 5a7c27f

Please sign in to comment.