Fix crash when notification state is empty.

This commit is contained in:
Greyson Parrelli 2020-01-26 21:36:23 -05:00
parent fea2b6253f
commit 5d54ebfaa0

View file

@ -340,7 +340,7 @@ public class MessageNotifier {
if (notificationState.getNotifications().isEmpty()) { if (notificationState.getNotifications().isEmpty()) {
if (!bundled) cancelActiveNotifications(context); if (!bundled) cancelActiveNotifications(context);
Log.i(TAG, "Empty notification state. Skipping."); Log.i(TAG, "[sendSingleThreadNotification] Empty notification state. Skipping.");
return; return;
} }
@ -408,6 +408,11 @@ public class MessageNotifier {
{ {
Log.i(TAG, "sendMultiThreadNotification() signal: " + signal); Log.i(TAG, "sendMultiThreadNotification() signal: " + signal);
if (notificationState.getNotifications().isEmpty()) {
Log.i(TAG, "[sendMultiThreadNotification] Empty notification state. Skipping.");
return;
}
MultipleRecipientNotificationBuilder builder = new MultipleRecipientNotificationBuilder(context, TextSecurePreferences.getNotificationPrivacy(context)); MultipleRecipientNotificationBuilder builder = new MultipleRecipientNotificationBuilder(context, TextSecurePreferences.getNotificationPrivacy(context));
List<NotificationItem> notifications = notificationState.getNotifications(); List<NotificationItem> notifications = notificationState.getNotifications();