Make sure channel and connection exists before closing

This commit is contained in:
Jonathan Leibiusky @xetorthio
2017-09-07 16:40:52 -03:00
parent 4b7589bc67
commit d29a02bb22

View File

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