recent_project: Fix overflow sub (#15965)

CharlesChen0823 created

close: #15783 

Release Notes:

- Fixed a potential panic that can occur when deleting entries from the
recent-projects menu
([#15783](https://github.com/zed-industries/zed/issues/15783))

Change summary

crates/recent_projects/src/recent_projects.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Detailed changes

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)
                 })