From 705e63a0d708b8f0f498566a58de1c9f406d3a52 Mon Sep 17 00:00:00 2001 From: Aniket Gawade Date: Mon, 30 Nov 2020 16:50:36 -0800 Subject: [PATCH] Ignoring close if TransportSSH is nil --- netconf/transport_ssh.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/netconf/transport_ssh.go b/netconf/transport_ssh.go index d02c93b..d845c11 100644 --- a/netconf/transport_ssh.go +++ b/netconf/transport_ssh.go @@ -38,6 +38,11 @@ type TransportSSH struct { // Close closes an existing SSH session and socket if they exist. func (t *TransportSSH) Close() error { + // If TransportSSH is nil ignore closing ssh session + if t == nil { + return nil + } + // Close the SSH Session if we have one if t.sshSession != nil { if err := t.sshSession.Close(); err != nil {