# Fix panic when doing various cursor movements with a pending mouse selection \(\#13016\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 066cdc22978451041fd8b63ac9213fd863f0ddaa

Requested commit: 066cdc22978451041fd8b63ac9213fd863f0ddaa

Commit: 066cdc22978451041fd8b63ac9213fd863f0ddaa

Tree: 43bc231bc05f23ab3163a8f80c56bd4bda58f3fd

Author: Max Brunsfeld

Committer: GitHub

## Message

```
Fix panic when doing various cursor movements with a pending mouse selection (#13016)

This fixes a panic in the `SelectionsCollection::first_anchor` when
there was a pending mouse selection and no other selections. Until
recently, this method was only used in vim mode, but as of
https://github.com/zed-industries/zed/commit/53b0720d546b6541fbf236d2f9d2dadbce6f126e,
it's also used in the normal `move_up` and `move_down` actions.

So until recently, the panic that this fixes could only happen in vim
mode.

Release Notes:

- Fixed a crash that could happen when using certain cursor-motion
bindings with a pending mouse selection.
```

## Parents

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

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