Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

recent_project: Fix overflow sub (#15965)

CharlesChen0823a71bfd41cc8a
diff --git a/crates/recent_projects/src/recent_projects.rs b/crates/recent_projects/src/recent_projects.rs
index 7b75c280d61..fcb6ffef423 100644
--- a/crates/recent_projects/src/recent_projects.rs
+++ b/crates/recent_projects/src/recent_projects.rs
@@ -669,7 +669,7 @@ impl RecentProjectsDelegate {
.unwrap_or_default();
this.update(&mut cx, move |picker, cx| {
picker.delegate.set_workspaces(workspaces);
- picker.delegate.set_selected_index(ix - 1, cx);
+ picker.delegate.set_selected_index(ix.saturating_sub(1), cx);
picker.delegate.reset_selected_match_index = false;
picker.update_matches(picker.query(cx), cx)
})