Skip to content

Commit

Permalink
fix(watch): don't panic if there's no path provided
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlomieju committed Nov 21, 2024
1 parent e515ed2 commit c83a485
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cli/util/file_watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,14 @@ impl WatcherCommunicator {

pub fn show_path_changed(&self, changed_paths: Option<Vec<PathBuf>>) {
if let Some(paths) = changed_paths {
self.print(
format!("Restarting! File change detected: {:?}", paths[0]).to_string(),
)
if !paths.is_empty() {
self.print(
format!("Restarting! File change detected: {:?}", paths[0])
.to_string(),
)
} else {
self.print(format!("Restarting! File change detected.").to_string())
}
}
}
}
Expand Down

0 comments on commit c83a485

Please sign in to comment.