Fix segfault in "install:cli" when app is not yet installed (#9427)

Conrad Irwin created

Release Notes:

- Fixed a panic running `cli: Install` or `cli: Register Zed Scheme`
before installing the app.

Change summary

crates/gpui/src/platform/mac/platform.rs | 5 +++++
1 file changed, 5 insertions(+)

Detailed changes

crates/gpui/src/platform/mac/platform.rs 🔗

@@ -553,6 +553,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 {