ensure we don't crash on deleted files

This commit is contained in:
Robin Malfait 2024-03-07 20:50:19 +01:00
parent 1b3ad0db65
commit 6282e2b22e
No known key found for this signature in database

View file

@ -433,9 +433,9 @@ fn read_all_files_sync(changed_content: Vec<ChangedContent>) -> Vec<Vec<u8>> {
changed_content
.into_iter()
.map(|c| match (c.file, c.content) {
(Some(file), None) => std::fs::read(file).unwrap(),
(None, Some(content)) => content.into_bytes(),
.filter_map(|c| match (c.file, c.content) {
(Some(file), None) => std::fs::read(file).ok(),
(None, Some(content)) => Some(content.into_bytes()),
_ => Default::default(),
})
.collect()