Skip to content

Commit 9987ff5

Browse files
avoid calling close for nil inbound/outblock channels
1 parent cff8235 commit 9987ff5

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

internal/grid/muxserver.go

+10-4
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,15 @@ func (m *muxServer) close() {
325325
m.cancel()
326326
m.recvMu.Lock()
327327
defer m.recvMu.Unlock()
328-
xioutil.SafeClose(m.inbound)
329-
m.inbound = nil
330328

331-
xioutil.SafeClose(m.outBlock)
332-
m.outBlock = nil
329+
if m.inbound != nil {
330+
xioutil.SafeClose(m.inbound)
331+
m.inbound = nil
332+
}
333+
334+
if m.outBlock != nil {
335+
xioutil.SafeClose(m.outBlock)
336+
m.outBlock = nil
337+
338+
}
333339
}

0 commit comments

Comments
 (0)