Skip to content

Commit 5d09868

Browse files
committed
Fix unsafe precondition violation when building with nightly rustc
Fixes zed-industries#8658
1 parent eb1ab69 commit 5d09868

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::{
55
MenuItem, PathPromptOptions, Platform, PlatformDisplay, PlatformInput, PlatformTextSystem,
66
PlatformWindow, Result, SemanticVersion, Task, WindowAppearance, WindowOptions,
77
};
8-
use anyhow::anyhow;
8+
use anyhow::{anyhow, bail};
99
use block::ConcreteBlock;
1010
use cocoa::{
1111
appkit::{
@@ -685,6 +685,9 @@ impl Platform for MacPlatform {
685685
Err(anyhow!("app is not running inside a bundle"))
686686
} else {
687687
let version: id = msg_send![bundle, objectForInfoDictionaryKey: ns_string("CFBundleShortVersionString")];
688+
if version.is_null() {
689+
bail!("bundle does not have version");
690+
}
688691
let len = msg_send![version, lengthOfBytesUsingEncoding: NSUTF8StringEncoding];
689692
let bytes = version.UTF8String() as *const u8;
690693
let version = str::from_utf8(slice::from_raw_parts(bytes, len)).unwrap();

0 commit comments

Comments
 (0)