From d06ca7897dc8e72f4e3ccf5116269544b57ad7a1 Mon Sep 17 00:00:00 2001 From: sreedev Date: Wed, 25 Jan 2023 23:12:52 -0500 Subject: [PATCH] fix critical error --- src/scanner.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/scanner.rs b/src/scanner.rs index 2ac99ae..35a32ca 100644 --- a/src/scanner.rs +++ b/src/scanner.rs @@ -61,7 +61,11 @@ fn scan(app_opts: &Params) -> Result> { .map(|fpath| File { path: fpath.clone(), hash: None, - size: Some(fs::metadata(fpath).unwrap().len()), + size: Some( + fs::metadata(fpath) + .map(|metadata| metadata.len()) + .unwrap_or_default(), + ), }) .filter(|file| filters::is_file_gt_min_size(app_opts, file)) .collect(); @@ -84,7 +88,7 @@ fn process_file_index( IndexCritera::Hash => { file.hash = Some(hash_file(&file.path).unwrap_or_default()); store - .entry(file.clone().hash.unwrap()) + .entry(file.clone().hash.unwrap_or_default()) .and_modify(|fileset| fileset.push(file.clone())) .or_insert_with(|| vec![file]); }