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_projects: Don't panic when attempting to delete SSH server out of bounds (#51091)

Piotr Osiewicz4abeeda0b246
diff --git a/crates/recent_projects/src/remote_servers.rs b/crates/recent_projects/src/remote_servers.rs
index a94f7b1d57e..b094ff6c5bc 100644
--- a/crates/recent_projects/src/remote_servers.rs
+++ b/crates/recent_projects/src/remote_servers.rs
@@ -1656,7 +1656,9 @@ impl RemoteServerProjects {
fn delete_ssh_server(&mut self, server: SshServerIndex, cx: &mut Context<Self>) {
self.update_settings_file(cx, move |setting, _| {
- if let Some(connections) = setting.ssh_connections.as_mut() {
+ if let Some(connections) = setting.ssh_connections.as_mut()
+ && connections.get(server.0).is_some()
+ {
connections.remove(server.0);
}
});