Skip to content

Commit a527e68

Browse files
Merge pull request #102 from aniketgawade/ignore_close_if_nil
Ignoring close if TransportSSH is nil
2 parents 6bda392 + 705e63a commit a527e68

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

netconf/transport_ssh.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ type TransportSSH struct {
3838

3939
// Close closes an existing SSH session and socket if they exist.
4040
func (t *TransportSSH) Close() error {
41+
// If TransportSSH is nil ignore closing ssh session
42+
if t == nil {
43+
return nil
44+
}
45+
4146
// Close the SSH Session if we have one
4247
if t.sshSession != nil {
4348
if err := t.sshSession.Close(); err != nil {

0 commit comments

Comments
 (0)