fix(config): crash if unable to watch config folder (#3761)

This commit is contained in:
Aram Drevekenin 2024-11-11 19:01:08 +01:00 committed by GitHub
parent 3f719d1c50
commit 7bcd5696a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -707,10 +707,13 @@ fn report_changes_in_config_file(
})
.unwrap();
if let Some(config_file_parent_folder) = config_file_path.parent() {
watcher
.watch(&config_file_parent_folder, RecursiveMode::Recursive)
.unwrap();
Some(Box::new(watcher))
match watcher.watch(&config_file_parent_folder, RecursiveMode::Recursive) {
Ok(_) => Some(Box::new(watcher)),
Err(e) => {
log::error!("Failed to watch config file folder: {}", e);
None
},
}
} else {
log::error!("Could not find config parent folder");
None