mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-12 05:15:00 +00:00
Merge pull request #2366 from zed-industries/avoid-unwrapping-on-try-send
Don't panic if worktree was dropped before sending path changes
This commit is contained in:
commit
116d4f20fa
1 changed files with 2 additions and 3 deletions
|
@ -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"))?
|
||||
|
|
Loading…
Reference in a new issue