From 9987ff570bcea7c26a8faec32910f10f49576d0c Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Sun, 28 Jan 2024 19:56:15 -0800 Subject: [PATCH] avoid calling close for nil inbound/outblock channels --- internal/grid/muxserver.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/internal/grid/muxserver.go b/internal/grid/muxserver.go index f59085010..183a463b3 100644 --- a/internal/grid/muxserver.go +++ b/internal/grid/muxserver.go @@ -325,9 +325,15 @@ func (m *muxServer) close() { m.cancel() m.recvMu.Lock() defer m.recvMu.Unlock() - xioutil.SafeClose(m.inbound) - m.inbound = nil - xioutil.SafeClose(m.outBlock) - m.outBlock = nil + if m.inbound != nil { + xioutil.SafeClose(m.inbound) + m.inbound = nil + } + + if m.outBlock != nil { + xioutil.SafeClose(m.outBlock) + m.outBlock = nil + + } }