Skip to content

Commit

Permalink
config: check for err after os.ReadDir()
Browse files Browse the repository at this point in the history
  • Loading branch information
raghavendra-talur authored and medyagh committed Jul 26, 2024
1 parent 6993bd5 commit 6a417d5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/minikube/config/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 6a417d5

Please sign in to comment.