From 83862569e2b2a99ebc17674cd16adf8c711075c0 Mon Sep 17 00:00:00 2001 From: Levi Bard Date: Fri, 2 Dec 2022 19:46:02 +0100 Subject: [PATCH] Nullcheck channels when reading importance. (#2971) Fixes #2970 --- .../tusky/components/notifications/NotificationHelper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/components/notifications/NotificationHelper.java b/app/src/main/java/com/keylesspalace/tusky/components/notifications/NotificationHelper.java index 106084d1..af70cce2 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/notifications/NotificationHelper.java +++ b/app/src/main/java/com/keylesspalace/tusky/components/notifications/NotificationHelper.java @@ -473,7 +473,7 @@ public class NotificationHelper { if (notificationManager.areNotificationsEnabled()) { for (NotificationChannel channel : notificationManager.getNotificationChannels()) { - if (channel.getImportance() > NotificationManager.IMPORTANCE_NONE) { + if (channel != null && channel.getImportance() > NotificationManager.IMPORTANCE_NONE) { Log.d(TAG, "NotificationsEnabled"); return true; } @@ -546,7 +546,7 @@ public class NotificationHelper { return false; } NotificationChannel channel = notificationManager.getNotificationChannel(channelId); - return channel.getImportance() > NotificationManager.IMPORTANCE_NONE; + return channel != null && channel.getImportance() > NotificationManager.IMPORTANCE_NONE; } switch (type) {