From cfdbfa927d511162812ad732c44b30b3c2c632d8 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:47 -0600 Subject: [PATCH] Fix segfault in "install:cli" when app is not yet installed (cherry-pick #9427) (#9431) 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 427c95df7163888c834e583828bc0a7d4d85b391..ca99c1e8410658669d39dc9e611ebfaef346f5fc 100644 --- a/crates/gpui/src/platform/mac/platform.rs +++ b/crates/gpui/src/platform/mac/platform.rs @@ -552,6 +552,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 {