regression: Fix a panic when removing git-containing worktree from the project panel (#15256)
Follow-up of #14989 Opening a project with git metadata and clicking "Remove from Project" will panic:  Release Notes: - N/A
This commit is contained in:
parent
18daf17d0e
commit
7aa6f4788d
1 changed files with 9 additions and 1 deletions
|
@ -96,7 +96,15 @@ impl WorktreeStore {
|
||||||
pub fn remove_worktree(&mut self, id_to_remove: WorktreeId, cx: &mut ModelContext<Self>) {
|
pub fn remove_worktree(&mut self, id_to_remove: WorktreeId, cx: &mut ModelContext<Self>) {
|
||||||
self.worktrees.retain(|worktree| {
|
self.worktrees.retain(|worktree| {
|
||||||
if let Some(worktree) = worktree.upgrade() {
|
if let Some(worktree) = worktree.upgrade() {
|
||||||
worktree.read(cx).id() != id_to_remove
|
if worktree.read(cx).id() == id_to_remove {
|
||||||
|
cx.emit(WorktreeStoreEvent::WorktreeRemoved(
|
||||||
|
worktree.entity_id(),
|
||||||
|
id_to_remove,
|
||||||
|
));
|
||||||
|
false
|
||||||
|
} else {
|
||||||
|
true
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue