twpayne / find-duplicates

Find duplicate files quickly.
MIT License
44 stars 1 forks source link

fix: avoid division by zero when calculating statistics #8

Closed Juneezee closed 8 months ago

Juneezee commented 8 months ago

This commit fixes an edge case where an empty directory is provided. In that case, dirEntries and totalBytes will be zero.

How to reproduce:

$ mkdir emptydir
$ find-duplicates --statistics ./emptydir
{}
json: unsupported value: NaN
twpayne commented 8 months ago

Perfect, thank you very much!