Add sanity check for the method

This commit is contained in:
ismailgulek
2021-05-10 17:29:24 +03:00
parent 93bd3c1ac8
commit 3bef3d2bec

View File

@@ -32,7 +32,7 @@ class NotificationService: UNNotificationServiceExtension {
// MARK: - Properties // MARK: - Properties
/// Receiving dates for notifications /// Receiving dates for notifications. Keys are eventId's
private var receiveDates: [String: Date] = [:] private var receiveDates: [String: Date] = [:]
/// Content handlers. Keys are eventId's /// Content handlers. Keys are eventId's
@@ -588,6 +588,11 @@ class NotificationService: UNNotificationServiceExtension {
if event.isEncrypted { if event.isEncrypted {
if #available(iOS 13.0, *) { if #available(iOS 13.0, *) {
guard event.clear != nil else {
NSLog("[NotificationService] sendVoipPush: Do not send a VoIP push for undecrypted event, it'll cause a crash.")
return
}
}
pushNotificationStore.storeCallInvite(event.clear) pushNotificationStore.storeCallInvite(event.clear)
} else { } else {
pushNotificationStore.storeCallInvite(event) pushNotificationStore.storeCallInvite(event)