From d29a02bb2263930671df84955e7514f547227ce8 Mon Sep 17 00:00:00 2001 From: "Jonathan Leibiusky @xetorthio" Date: Thu, 7 Sep 2017 16:40:52 -0300 Subject: [PATCH] Make sure channel and connection exists before closing --- handlers/terms.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/handlers/terms.go b/handlers/terms.go index cb1e9cd..0b4a1c6 100644 --- a/handlers/terms.go +++ b/handlers/terms.go @@ -110,8 +110,12 @@ func (m *manager) disconnect(instance *types.Instance) { } t := m.terminals[instance.Name] - close(t.write) - t.conn.Close() + if t.write != nil { + close(t.write) + } + if t.conn != nil { + t.conn.Close() + } m.untrackInstance(instance) }