Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Don't panic if worktree was dropped before sending path changes
Antonio Scandurra372e31d54f5e
diff --git a/crates/project/src/worktree.rs b/crates/project/src/worktree.rsindex 3a9838c62d5..72e05dd1f9b 100644--- a/crates/project/src/worktree.rs+++ b/crates/project/src/worktree.rs@@ -838,8 +838,7 @@ impl LocalWorktree {.unwrap().path_changes_tx.try_send((vec![abs_path], tx))- .unwrap();- });+ })?;rx.recv().await;Ok(())}))@@ -930,7 +929,7 @@ impl LocalWorktree {}let (tx, mut rx) = barrier::channel();- path_changes_tx.try_send((paths, tx)).unwrap();+ path_changes_tx.try_send((paths, tx))?;rx.recv().await;this.upgrade(&cx).ok_or_else(|| anyhow!("worktree was dropped"))?