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.

Fix panic in remote workspaces (#50647)

Conrad Irwin6a38c5c0a0fe
diff --git a/crates/recent_projects/src/remote_servers.rs b/crates/recent_projects/src/remote_servers.rs
index 6c0ce4b1885..a94f7b1d57e 100644
--- a/crates/recent_projects/src/remote_servers.rs
+++ b/crates/recent_projects/src/remote_servers.rs
@@ -1161,12 +1161,11 @@ impl RemoteServerProjects {
workspace.toggle_modal(window, cx, |window, cx| {
RemoteConnectionModal::new(&connection_options, Vec::new(), window, cx)
});
- let prompt = workspace
- .active_modal::<RemoteConnectionModal>(cx)
- .unwrap()
- .read(cx)
- .prompt
- .clone();
+ // can be None if another copy of this modal opened in the meantime
+ let Some(modal) = workspace.active_modal::<RemoteConnectionModal>(cx) else {
+ return;
+ };
+ let prompt = modal.read(cx).prompt.clone();
let connect = connect(
ConnectionIdentifier::setup(),