From 7156fc5657bd6199e7f83fce5e8b551f5e4bd9ba Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Sat, 10 Apr 2021 21:10:27 +0200 Subject: [PATCH] fix try-catch for cleanAllOldNotificationChannels --- .../conversations/services/NotificationService.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java index bff00ec21..d4b5af6af 100644 --- a/src/main/java/eu/siacs/conversations/services/NotificationService.java +++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java @@ -476,16 +476,16 @@ public class NotificationService { @RequiresApi(api = Build.VERSION_CODES.O) public void cleanAllOldNotificationChannels(final Context context) { final NotificationManager notificationManager = context.getSystemService(NotificationManager.class); - final int channels = notificationManager.getNotificationChannels().size(); - for (int i1 = 0; i1 < channels; i1++) { - try { + try { + final int channels = notificationManager.getNotificationChannels().size(); + for (int i1 = 0; i1 < channels; i1++) { final String channelID = notificationManager.getNotificationChannels().get(i1).getId(); if (channelID.startsWith(OLD_INDIVIDUAL_NOTIFICATION_PREFIX)) { notificationManager.deleteNotificationChannel(channelID); } - } catch (Exception e) { - e.printStackTrace(); } + } catch (Exception e) { + e.printStackTrace(); } try { final int groups = notificationManager.getNotificationChannelGroups().size();