App crash in android sometimes while opening the notifications (#5776) (#5781)

* Checks for condition before removing the notification

* Misc

(cherry picked from commit fe12190f4b)

Co-authored-by: Anurag Shivarathri <anurag6713@gmail.com>
This commit is contained in:
Mattermost Build 2021-10-24 19:47:55 +02:00 committed by GitHub
parent 53d6c60d8d
commit 688e174ae4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -215,9 +215,12 @@ public class CustomPushNotification extends PushNotification {
if (channelId != null) {
Map<String, List<Integer>> notificationsInChannel = loadNotificationsMap(mContext);
List<Integer> notifications = notificationsInChannel.get(channelId);
if (notifications == null) {
return;
}
notifications.remove(notificationId);
saveNotificationsMap(mContext, notificationsInChannel);
clearChannelNotifications(mContext, channelId);
clearChannelNotifications(mContext, channelId);
}
}