From 6a417d52c12c2030dc1e48ec1c43737f7afd661a Mon Sep 17 00:00:00 2001 From: Raghavendra Talur Date: Mon, 17 Jul 2023 23:18:14 -0400 Subject: [PATCH] config: check for err after os.ReadDir() --- pkg/minikube/config/profile.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/minikube/config/profile.go b/pkg/minikube/config/profile.go index 65ac95d5128b..0f67fa09606a 100644 --- a/pkg/minikube/config/profile.go +++ b/pkg/minikube/config/profile.go @@ -303,6 +303,10 @@ func profileDirs(miniHome ...string) (dirs []string, err error) { } pRootDir := filepath.Join(miniPath, "profiles") items, err := os.ReadDir(pRootDir) + if os.IsNotExist(err) { + return dirs, &ErrNotExist{fmt.Sprintf("profiles dir %s does not exist", pRootDir)} + } + for _, f := range items { if f.IsDir() { dirs = append(dirs, f.Name())