Skip to content

Commit

Permalink
Prevent crash when clicking on notification during send
Browse files Browse the repository at this point in the history
  • Loading branch information
TaeHagen committed Nov 21, 2024
1 parent 2d9d4bd commit 7aedb56
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ class InternalIntentReceiver: BroadcastReceiver() {
val notificationManager = context.getSystemService(NotificationManager::class.java)
// this is used to copy the style, since the notification already exists
Log.d(Constants.logTag, "Fetching existing notification values")
val chatNotification = notificationManager.activeNotifications.last { it.id == notificationId }
val chatNotification = notificationManager.activeNotifications.lastOrNull { it.id == notificationId }
?: return@createWorker // notification no longer exists
val oldBuilder = Notification.Builder.recoverBuilder(context, chatNotification.notification)
val oldStyle = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
oldBuilder.style as Notification.MessagingStyle
Expand Down

0 comments on commit 7aedb56

Please sign in to comment.