From db09e1376a44023d495eb9cf948ca080f6a8ba55 Mon Sep 17 00:00:00 2001 From: enahum Date: Fri, 22 Dec 2017 16:11:00 -0300 Subject: [PATCH] Make sure that channelIdToNotification is not null (#1320) --- .../com/mattermost/rnbeta/CustomPushNotification.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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 4e00f8be2..25545d8c6 100644 --- a/android/app/src/main/java/com/mattermost/rnbeta/CustomPushNotification.java +++ b/android/app/src/main/java/com/mattermost/rnbeta/CustomPushNotification.java @@ -210,9 +210,15 @@ public class CustomPushNotification extends PushNotification { String summaryTitle = String.format("%s (%d)", title, numMessages); Notification.InboxStyle style = new Notification.InboxStyle(); - List list = new ArrayList(channelIdToNotification.get(channelId)); + List bundleArray = channelIdToNotification.get(channelId); + List list; + if (bundleArray != null) { + list = new ArrayList(bundleArray); + } else { + list = new ArrayList(); + } - for (Bundle data : list){ + for (Bundle data : list) { String msg = data.getString("message"); if (msg != message) { style.addLine(data.getString("message"));