# Ensure item-closing actions do not panic when no items are present \(\#31845\) · gitcafe/zed

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

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

Visibility: public

Requested revision: f13f2dfb70f28fae4f844d99b80d875588501a8f

Requested commit: f13f2dfb70f28fae4f844d99b80d875588501a8f

Commit: f13f2dfb70f28fae4f844d99b80d875588501a8f

Tree: 01693985b2869fbf50125e3f76e53c8a1d25a5d6

Author: Joseph T\. Lyons

Committer: GitHub

## Message

```
Ensure item-closing actions do not panic when no items are present (#31845)

This PR adds a comprehensive test that ensures that no item-closing
action will panic when no items are present. A test already existed
(`test_remove_active_empty `) that ensured `CloseActiveItem` didn't
panic, but the new test covers:

- `CloseActiveItem`
- `CloseInactiveItems`
- `CloseAllItems`
- `CloseCleanItems`
- `CloseItemsToTheRight`
- `CloseItemsToTheLeft`

I plan to do a bit more clean up in `pane.rs` and this feels like a good
thing to add before that.

Release Notes:

- N/A
```

## Parents

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

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