Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: crash when application launched from UNUserNotificationCenter notification #25702

Merged
merged 1 commit into from Oct 2, 2020

Conversation

miniak
Copy link
Contributor

@miniak miniak commented Sep 30, 2020

Description of Change

We have a custom node module, which is using the new UNUserNotificationCenter APIs to show notifications. When the application is launched from such notification, the NSApplicationLaunchUserNotificationKey points to a UNNotificationResponse instance instead of NSNotification. This leads to an unrecognized selector exception. Check for NSNotification before accessing the userInfo property.

We can also use the NSApplicationLaunchUserNotificationKey directly, as it was introduced in macOS 10.8
Checking userInfo for nil is not necessary, as it's done by NSDictionaryToDictionaryValue.

Checklist

Release Notes

Notes: Fixed crash when application launched from UNUserNotificationCenter notification (via a native node module).

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Sep 30, 2020
@miniak miniak self-assigned this Sep 30, 2020
@miniak miniak force-pushed the miniak/fix-notification-crash branch from c6fe695 to 0f5d3d6 Compare September 30, 2020 16:46
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Oct 1, 2020
@miniak miniak force-pushed the miniak/fix-notification-crash branch from 0f5d3d6 to 8304453 Compare October 1, 2020 19:41
@alexeykuzmin alexeykuzmin merged commit 17c7c5c into master Oct 2, 2020
@release-clerk
Copy link

release-clerk bot commented Oct 2, 2020

Release Notes Persisted

Fixed crash when application launched from UNUserNotificationCenter notification (via a native node module).

@trop
Copy link
Contributor

trop bot commented Oct 2, 2020

I have automatically backported this PR to "10-x-y", please check out #25737

@trop
Copy link
Contributor

trop bot commented Oct 2, 2020

I have automatically backported this PR to "11-x-y", please check out #25738

@trop trop bot removed the target/11-x-y label Oct 2, 2020
@trop
Copy link
Contributor

trop bot commented Oct 2, 2020

I have automatically backported this PR to "9-x-y", please check out #25739

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants