# Fix race condition in OpenPathDelegate \(\#57290\) · gitcafe/zed

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

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

Visibility: public

Requested revision: ddb847d03af4a45d987dc0405f7930922656fdfd

Requested commit: ddb847d03af4a45d987dc0405f7930922656fdfd

Commit: ddb847d03af4a45d987dc0405f7930922656fdfd

Tree: 7e6908ad8767897a20be0cc6b1bde990ff21c06d

Author: Oleksiy Syvokon

Committer: GitHub

## Message

```
Fix race condition in OpenPathDelegate (#57290)

Directory entries and string matches can briefly go out of sync during
async updates. When that happens, we used to highlight the wrong
substring (best case), or panic if the offset happens to be mid-Unicode
or out of range.

After this change, we fall back to rendering a row without highlights
when matches are out of sync. The highlight will be shown on the next
frame. This is a rare condition and the easiest fix, so should be
acceptable.

Closes FR-11

Release Notes:

- Fixed rare panic in the open path dialog
```

## Parents

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

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