From 688e174ae46511d7862858ffe4e19ac6085b774e Mon Sep 17 00:00:00 2001 From: Mattermost Build Date: Sun, 24 Oct 2021 19:47:55 +0200 Subject: [PATCH] App crash in android sometimes while opening the notifications (#5776) (#5781) * Checks for condition before removing the notification * Misc (cherry picked from commit fe12190f4b10d3b7af0180d06772028e8115ce09) Co-authored-by: Anurag Shivarathri --- .../java/com/mattermost/rnbeta/CustomPushNotification.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/android/app/src/main/java/com/mattermost/rnbeta/CustomPushNotification.java b/android/app/src/main/java/com/mattermost/rnbeta/CustomPushNotification.java index 2bf701de3..14a2b9665 100644 --- a/android/app/src/main/java/com/mattermost/rnbeta/CustomPushNotification.java +++ b/android/app/src/main/java/com/mattermost/rnbeta/CustomPushNotification.java @@ -215,9 +215,12 @@ public class CustomPushNotification extends PushNotification { if (channelId != null) { Map> notificationsInChannel = loadNotificationsMap(mContext); List notifications = notificationsInChannel.get(channelId); + if (notifications == null) { + return; + } notifications.remove(notificationId); saveNotificationsMap(mContext, notificationsInChannel); - clearChannelNotifications(mContext, channelId); + clearChannelNotifications(mContext, channelId); } }