Browse Source

fix: crash when application launched from UNUserNotificationCenter notification (#25739)

Co-authored-by: Milan Burda <[email protected]>
trop[bot] 4 years ago
parent
commit
82151b4f0d
1 changed files with 2 additions and 2 deletions
  1. 2 2
      shell/browser/mac/electron_application_delegate.mm

+ 2 - 2
shell/browser/mac/electron_application_delegate.mm

@@ -69,9 +69,9 @@ static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session;
 
 - (void)applicationDidFinishLaunching:(NSNotification*)notify {
   NSUserNotification* user_notification =
-      [notify userInfo][(id) @"NSApplicationLaunchUserNotificationKey"];
+      [notify userInfo][NSApplicationLaunchUserNotificationKey];
 
-  if (user_notification.userInfo) {
+  if ([user_notification isKindOfClass:[NSUserNotification class]]) {
     electron::Browser::Get()->DidFinishLaunching(
         electron::NSDictionaryToDictionaryValue(user_notification.userInfo));
   } else {