# git_ui: Prevent crash when selecting collapsed sections \(\#63164\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 507a1b994c883a199d536155ce59332fcb100f92

Requested commit: 507a1b994c883a199d536155ce59332fcb100f92

Commit: 507a1b994c883a199d536155ce59332fcb100f92

Tree: 086e6fe1fa10d55def2a9317fe272b819603f3ff

Author: Cole Miller

Committer: GitHub

## Message

```
git_ui: Prevent crash when selecting collapsed sections (#63164)

## Summary

- Select the first Git panel entry from the visible row indices instead
of treating an entry index as a visible-row position
- Avoid selecting files hidden by collapsed sections in both tree and
flat views
- Add a regression test for collapsing the only populated section in
tree view with no active selection

Fixes ZED-AZ3
Fixes ZED-B0Z

Release Notes:

- Fixed a crash in the Git panel when collapsed sections were used in
tree view.
```

## Parents

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

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