# Fix crash when fallback workspace is in the removal set \(\#53549\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/1150c9d6640933f41a4e57eb67c5ec503ba8f4bb)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 1150c9d6640933f41a4e57eb67c5ec503ba8f4bb

Requested commit: 1150c9d6640933f41a4e57eb67c5ec503ba8f4bb

Commit: 1150c9d6640933f41a4e57eb67c5ec503ba8f4bb

Tree: 01ecfc335d911df47174da8effd7713c1e487d08

Author: Richard Feldman

Committer: GitHub

## Message

```
Fix crash when fallback workspace is in the removal set (#53549)

When removing a project group, the fallback closure calls
`find_or_create_local_workspace` which searches `self.workspaces` for an
existing match. Because the workspaces to be removed haven't been
removed yet at that point, `workspace_for_paths` can return a doomed
workspace, hitting the `assert!` in `MultiWorkspace::remove` and
crashing the app.

Fix by adding an `excluding` parameter to
`find_or_create_local_workspace` so callers inside removal fallbacks can
skip workspaces that are about to be removed. Both
`remove_project_group` and `sidebar::archive_thread` now pass the
appropriate exclusion set.

Adds a regression test that deterministically reproduces the crash (the
assert fires without the exclusion, passes with it).

Release Notes:

- Fixed a crash when closing a project group whose fallback workspace
matched one being removed.
```

## Parents

- [1c1f2d6f4c61874943be4c61cc354a424ea4e8d6](https://git.cafe/gitcafe/zed/commit/1c1f2d6f4c61874943be4c61cc354a424ea4e8d6?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/1150c9d6640933f41a4e57eb67c5ec503ba8f4bb?format=markdown)
