Skip to content

Commit

Permalink
Fix #20 by unwrapping file_details safely
Browse files Browse the repository at this point in the history
  • Loading branch information
yretenai committed Dec 19, 2024
1 parent 54a0274 commit e67ec6d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/cache/file_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ impl FileIndex {
}

pub async fn add(&self, lf: LocalFile) {
// TODO handle missing FileDetails gracefully
let file_details = self.file_lists.filedetails_for(&lf).await.unwrap();
let file_details = match self.file_lists.filedetails_for(&lf).await {
Some(file_details) => file_details,
None => return, // todo: filedetails_for is filtering out remote deleted files
};
let fdata: Arc<FileData> = FileData::new(lf.clone(), file_details).into();
self.file_id_map.write().await.insert(lf.file_id, fdata.clone());
let mut mfm_lock = self.mod_file_map.write().await;
Expand Down

0 comments on commit e67ec6d

Please sign in to comment.