From 5ec3b7b137c4fac3c9a63b5810593852305fd340 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 13 Mar 2023 10:04:43 -0700 Subject: [PATCH] Merge pull request #2273 from zed-industries/fix-dock-opening-in-collaboration Fix dock opening on collaboration --- crates/recent_projects/src/recent_projects.rs | 13 +++++++------ crates/workspace/src/workspace.rs | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/crates/recent_projects/src/recent_projects.rs b/crates/recent_projects/src/recent_projects.rs index f613ba4df2..e73d0b4fb5 100644 --- a/crates/recent_projects/src/recent_projects.rs +++ b/crates/recent_projects/src/recent_projects.rs @@ -165,12 +165,13 @@ impl PickerDelegate for RecentProjectsView { } fn confirm(&mut self, cx: &mut ViewContext) { - let selected_match = &self.matches[self.selected_index()]; - let workspace_location = &self.workspace_locations[selected_match.candidate_id]; - cx.dispatch_global_action(OpenPaths { - paths: workspace_location.paths().as_ref().clone(), - }); - cx.emit(Event::Dismissed); + if let Some(selected_match) = &self.matches.get(self.selected_index()) { + let workspace_location = &self.workspace_locations[selected_match.candidate_id]; + cx.dispatch_global_action(OpenPaths { + paths: workspace_location.paths().as_ref().clone(), + }); + cx.emit(Event::Dismissed); + } } fn dismiss(&mut self, cx: &mut ViewContext) { diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 609afded33..a7c80485f6 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -754,7 +754,7 @@ impl Workspace { cx.defer(move |_, cx| { Self::load_from_serialized_workspace(weak_handle, serialized_workspace, cx) }); - } else { + } else if project.read(cx).is_local() { if cx.global::().default_dock_anchor != DockAnchor::Expanded { Dock::show(&mut this, false, cx); }