From 952dc419292be95786d4a0503da0f68486fc0402 Mon Sep 17 00:00:00 2001 From: David Symonds Date: Wed, 17 Apr 2013 17:40:33 +1000 Subject: [PATCH] go.crypto/ssh/test: Fix distracting nil pointer dereference in a test. If cgo is disabled (such as it appears to be on a subset of builders), username() panics, and s.cmd is nil; let's not panic while recovering from a different panic. R=golang-dev, dave CC=golang-dev https://golang.org/cl/8820043 --- ssh/test/test_unix_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ssh/test/test_unix_test.go b/ssh/test/test_unix_test.go index f71beb6..045bc8f 100644 --- a/ssh/test/test_unix_test.go +++ b/ssh/test/test_unix_test.go @@ -128,7 +128,7 @@ func (s *server) Dial(config *ssh.ClientConfig) *ssh.ClientConn { } func (s *server) Shutdown() { - if s.cmd.Process != nil { + if s.cmd != nil && s.cmd.Process != nil { if err := s.cmd.Process.Kill(); err != nil { s.t.Error(err) }