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) }