lib/bunny/session.rb in bunny-2.20.0 vs lib/bunny/session.rb in bunny-2.20.1
- old
+ new
@@ -669,11 +669,15 @@
# this includes sending a channel.close-ok and
# potentially invoking a user-provided callback,
# avoid doing that while holding a mutex lock. MK.
ch.handle_method(method)
ensure
- # synchronises on @channel_mutex under the hood
- self.unregister_channel(ch)
+ if ch.nil?
+ @logger.warn "Received a server-sent channel.close but the channel was not found locally. Ignoring the frame."
+ else
+ # synchronises on @channel_mutex under the hood
+ self.unregister_channel(ch)
+ end
end
when AMQ::Protocol::Basic::GetEmpty then
ch = find_channel(ch_number)
ch.handle_basic_get_empty(method)
else