Skip to content

Commit

Permalink
Merge pull request #102 from aniketgawade/ignore_close_if_nil
Browse files Browse the repository at this point in the history
Ignoring close if TransportSSH is nil
  • Loading branch information
nileshsimaria authored Dec 8, 2020
2 parents 6bda392 + 705e63a commit a527e68
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions netconf/transport_ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a527e68

Please sign in to comment.