Skip to content

Commit

Permalink
Fix potential panic on directory permission errors
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Mar 3, 2024
1 parent 158f456 commit 4018512
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions walk.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ func walk(fileSystem LstatReadDirer, path string, walkFn filepath.WalkFunc, info
info, err := dirEntry.Info()
if err != nil {
switch err := walkFn(path, info, err); {
case errors.Is(err, fs.SkipDir) && info.IsDir():
// Do nothing.
case errors.Is(err, fs.SkipDir) && (info == nil || info.IsDir()):
continue
case err != nil:
return err
}
Expand Down

0 comments on commit 4018512

Please sign in to comment.