notifications: fix rare crash with local notification

This shouldn't happen, but I found a log that crashed here, so we will
fix this anyways.

Changelog-Fixed: Fix rare crash triggered by local notifications
This commit is contained in:
William Casarin
2023-08-06 08:09:23 -07:00
parent 5b9803d234
commit 624a7b4e88
2 changed files with 8 additions and 3 deletions

View File

@@ -58,7 +58,9 @@ class AppDelegate: NSObject, UIApplicationDelegate, UNUserNotificationCenterDele
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
let userInfo = response.notification.request.content.userInfo
let notification = LossyLocalNotification.from_user_info(user_info: userInfo)
guard let notification = LossyLocalNotification.from_user_info(user_info: userInfo) else {
return
}
notify(.local_notification(notification))
completionHandler()
}