Skip to content

Commit

Permalink
Prevent panic if fileinfo is nil (#4850)
Browse files Browse the repository at this point in the history
(cherry picked from commit 9cc534c)
  • Loading branch information
glinton authored and danielnelson committed Oct 12, 2018
1 parent 7a04c89 commit 3b6a43e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions plugins/inputs/filecount/filecount.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ func absDuration(x time.Duration) time.Duration {

func count(basedir string, recursive bool, countFn countFunc) error {
walkFn := func(path string, file os.FileInfo, err error) error {
if err != nil {
if os.IsNotExist(err) {
return nil
}
return err
}
if path == basedir {
return nil
}
Expand Down

0 comments on commit 3b6a43e

Please sign in to comment.