Fix crash on macOS before the app starts.

This commit is contained in:
John Preston 2021-11-02 00:07:22 +04:00
parent eae6e4fc60
commit dab3bce8ba

View file

@ -156,11 +156,15 @@ ApplicationDelegate *_sharedDelegate = nil;
} }
- (BOOL) applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag { - (BOOL) applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag {
if (const auto window = Core::App().activeWindow()) { Core::Sandbox::Instance().customEnterFromEventLoop([&] {
if (window->widget()->isHidden()) { if (Core::IsAppLaunched()) {
window->widget()->showFromTray(); if (const auto window = Core::App().activeWindow()) {
if (window->widget()->isHidden()) {
window->widget()->showFromTray();
}
}
} }
} });
return YES; return YES;
} }