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
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user