From 9a3111cb92d06ef4180ebcbee410c7fcfef03cdc Mon Sep 17 00:00:00 2001 From: "gcp-cherry-pick-bot[bot]" <98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com> Date: Mon, 18 Mar 2024 14:53:53 -0600 Subject: [PATCH] Fix segfault in "install:cli" when app is not yet installed (cherry-pick #9427) (#9430) Cherry-picked Fix segfault in "install:cli" when app is not yet installed (#9427) Release Notes: - Fixed a panic running `cli: Install` or `cli: Register Zed Scheme` before installing the app. Co-authored-by: Conrad Irwin --- crates/gpui/src/platform/mac/platform.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/gpui/src/platform/mac/platform.rs b/crates/gpui/src/platform/mac/platform.rs index d293f4cf4023aa3375989305f60a6ba8e33b6231..17533d3e760943044506a3c91035b994509382e4 100644 --- a/crates/gpui/src/platform/mac/platform.rs +++ b/crates/gpui/src/platform/mac/platform.rs @@ -548,6 +548,11 @@ impl Platform for MacPlatform { let workspace: id = msg_send![class!(NSWorkspace), sharedWorkspace]; let scheme: id = ns_string(scheme); let app: id = msg_send![workspace, URLForApplicationWithBundleIdentifier: bundle_id]; + if app == nil { + return Task::ready(Err(anyhow!( + "Cannot register URL scheme until app is installed" + ))); + } let done_tx = Cell::new(Some(done_tx)); let block = ConcreteBlock::new(move |error: id| { let result = if error == nil {