From 74e68b5f1cf945d82848848ba41480f48a26d092 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dud=C3=A1s=20=C3=81d=C3=A1m?= Date: Fri, 19 Nov 2021 15:21:19 +0100 Subject: [PATCH] avoid panic by checking before dereferencing --- pkg/internal/testing/controlplane/apiserver.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/internal/testing/controlplane/apiserver.go b/pkg/internal/testing/controlplane/apiserver.go index ece5efd651..d6a71dc951 100644 --- a/pkg/internal/testing/controlplane/apiserver.go +++ b/pkg/internal/testing/controlplane/apiserver.go @@ -414,10 +414,10 @@ func (s *APIServer) populateAPIServerCerts() error { // Stop stops this process gracefully, waits for its termination, and cleans up // the CertDir if necessary. func (s *APIServer) Stop() error { - if s.processState.DirNeedsCleaning { - s.CertDir = "" // reset the directory if it was randomly allocated, so that we can safely restart - } if s.processState != nil { + if s.processState.DirNeedsCleaning { + s.CertDir = "" // reset the directory if it was randomly allocated, so that we can safely restart + } if err := s.processState.Stop(); err != nil { return err }