Skip to content

Commit

Permalink
Fix file watcher panic when event has no paths (#14364)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaReiser authored Nov 16, 2024
1 parent c847cad commit a6a3d3f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crates/red_knot_workspace/src/watch/watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,15 @@ impl Debouncer {
}

let kind = event.kind;
let path = match SystemPathBuf::from_path_buf(event.paths.into_iter().next().unwrap()) {

// There are cases where paths can be empty.
// https://github.com/astral-sh/ruff/issues/14222
let Some(path) = event.paths.into_iter().next() else {
tracing::debug!("Ignoring change event with kind '{kind:?}' without a path",);
return;
};

let path = match SystemPathBuf::from_path_buf(path) {
Ok(path) => path,
Err(path) => {
tracing::debug!(
Expand Down

0 comments on commit a6a3d3f

Please sign in to comment.