# Fix crash when filtering items in Picker \(\#37929\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 22e31a0d410dc22d2fbeabe8530b6836d107bf78

Requested commit: 22e31a0d410dc22d2fbeabe8530b6836d107bf78

Commit: 22e31a0d410dc22d2fbeabe8530b6836d107bf78

Tree: 0687a5e9b0e1476ce193bec0887b275dee9d8be8

Author: Smit Barmase

Committer: GitHub

## Message

```
Fix crash when filtering items in Picker (#37929)

Closes #37617

We're already using `get` in a bunch of places, this PR updates the
remaining spots to follow the same pattern. Note that the `ix` we read
in `render_match` can sometimes be stale.

The likely reason is that we run the match-update logic asynchronously
(see
[here](https://github.com/zed-industries/zed/blob/138117e0b15664079f5526cb56168750382b49b9/crates/picker/src/picker.rs#L643)).
That means it's possible to render items after the list's [data
update](https://github.com/zed-industries/zed/blob/138117e0b15664079f5526cb56168750382b49b9/crates/picker/src/picker.rs#L652)
but before the [list
reset](https://github.com/zed-industries/zed/blob/138117e0b15664079f5526cb56168750382b49b9/crates/picker/src/picker.rs#L662),
in which case the `ix` can be greater than that of our updated data.

Release Notes:

- Fixed crash when filtering MCP tools.
```

## Parents

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

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