Skip to content

Commit 8f43f26

Browse files
authored
Merge pull request kubernetes-sigs#1724 from siliconbrain/patch-1
🐛 avoid panic in envtest by checking before dereferencing
2 parents 067c1dc + 74e68b5 commit 8f43f26

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/internal/testing/controlplane/apiserver.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,10 +414,10 @@ func (s *APIServer) populateAPIServerCerts() error {
414414
// Stop stops this process gracefully, waits for its termination, and cleans up
415415
// the CertDir if necessary.
416416
func (s *APIServer) Stop() error {
417-
if s.processState.DirNeedsCleaning {
418-
s.CertDir = "" // reset the directory if it was randomly allocated, so that we can safely restart
419-
}
420417
if s.processState != nil {
418+
if s.processState.DirNeedsCleaning {
419+
s.CertDir = "" // reset the directory if it was randomly allocated, so that we can safely restart
420+
}
421421
if err := s.processState.Stop(); err != nil {
422422
return err
423423
}

0 commit comments

Comments
 (0)