From bfa9230d3b92115f73854339da972881c0d41e90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 21 Nov 2024 16:29:40 +0000 Subject: [PATCH] fix(watch): don't panic if there's no path provided (#26972) Closes https://github.com/denoland/deno/issues/26970 --- cli/util/file_watcher.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cli/util/file_watcher.rs b/cli/util/file_watcher.rs index eb3fb8c602..b9318a6e4b 100644 --- a/cli/util/file_watcher.rs +++ b/cli/util/file_watcher.rs @@ -185,9 +185,11 @@ impl WatcherCommunicator { pub fn show_path_changed(&self, changed_paths: Option>) { 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])) + } else { + self.print("Restarting! File change detected.".to_string()) + } } } }