Fix panic in remote workspaces (#50647) (cherry-pick to preview) (#50650)
zed-zippy[bot]
and
Conrad Irwin
created
Cherry-pick of #50647 to preview
----
Fixes ZED-4JD
Release Notes:
- Fix a panic when opening the remote server modal
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
@@ -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(),