project_search: Guard replace_next match lookup (#48327)

Release Notes:

- N/A

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
This commit is contained in:
Xiaobo Liu authored and GitHub committed 2026-02-04 20:08:24 +01:00
1 parent 2c8bbfe182
commit ef94395614
1 file changed
+4 -3
+4 -3
View File
@@ -728,10 +728,11 @@ impl ProjectSearchView {
if let Some(query) = query {
let query = query.with_replacement(self.replacement(cx));
// TODO: Do we need the clone here?
let mat = self.entity.read(cx).match_ranges[active_index].clone();
let mat = self.entity.read(cx).match_ranges.get(active_index).cloned();
self.results_editor.update(cx, |editor, cx| {
editor.replace(&mat, &query, window, cx);
if let Some(mat) = mat.as_ref() {
editor.replace(mat, &query, window, cx);
}
});
self.select_match(Direction::Next, window, cx)
}