diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/cocoa.m | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/ui/cocoa.m b/ui/cocoa.m index e589534fa4..4753bb2f88 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -1398,20 +1398,21 @@ QemuCocoaView *cocoaView; [superView addSubview: picture_view]; /* Make the name label */ - x = 0; - y = y - 25; - int name_width = about_width, name_height = 20; - NSRect name_rect = NSMakeRect(x, y, name_width, name_height); - NSTextField *name_label = [[NSTextField alloc] initWithFrame: name_rect]; - [name_label setEditable: NO]; - [name_label setBezeled: NO]; - [name_label setDrawsBackground: NO]; - [name_label setAlignment: NSTextAlignmentCenter]; - NSString *qemu_name = [[NSString alloc] initWithCString: gArgv[0] - encoding: NSASCIIStringEncoding]; - qemu_name = [qemu_name lastPathComponent]; - [name_label setStringValue: qemu_name]; - [superView addSubview: name_label]; + NSBundle *bundle = [NSBundle mainBundle]; + if (bundle) { + x = 0; + y = y - 25; + int name_width = about_width, name_height = 20; + NSRect name_rect = NSMakeRect(x, y, name_width, name_height); + NSTextField *name_label = [[NSTextField alloc] initWithFrame: name_rect]; + [name_label setEditable: NO]; + [name_label setBezeled: NO]; + [name_label setDrawsBackground: NO]; + [name_label setAlignment: NSTextAlignmentCenter]; + NSString *qemu_name = [[bundle executablePath] lastPathComponent]; + [name_label setStringValue: qemu_name]; + [superView addSubview: name_label]; + } /* Set the version label's attributes */ x = 0; |