Skip to content

Commit

Permalink
Prevent panic if fileinfo is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
glinton authored and danielnelson committed Oct 12, 2018
1 parent 65f7e98 commit 3db30b0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions plugins/inputs/filecount/filecount.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ func absDuration(x time.Duration) time.Duration {
func (fc *FileCount) count(acc telegraf.Accumulator, basedir string, recursive bool) {
numFiles := int64(0)
walkFn := func(path string, file os.FileInfo, err error) error {
if file == nil {
return fmt.Errorf("Nil file found at %q", path)
}
if path == basedir {
return nil
}
Expand Down

0 comments on commit 3db30b0

Please sign in to comment.