From 3318b38b5cb750a86909ebef9714e310aa7a9803 Mon Sep 17 00:00:00 2001 From: Distopico Vegan Date: Tue, 20 Nov 2018 15:01:35 -0500 Subject: [PATCH] fix: missing null check on refactor notification --- .../java/org/dystopia/email/ServiceSynchronize.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/dystopia/email/ServiceSynchronize.java b/app/src/main/java/org/dystopia/email/ServiceSynchronize.java index 5dd845d4..2c80a12a 100644 --- a/app/src/main/java/org/dystopia/email/ServiceSynchronize.java +++ b/app/src/main/java/org/dystopia/email/ServiceSynchronize.java @@ -189,11 +189,11 @@ public class ServiceSynchronize extends LifecycleService { Long accountKey = message.account; List msgList = new ArrayList<>(); - if (messagesByAccount.indexOfKey(accountKey) != -1) { - msgList = messagesByAccount.get(accountKey); + if (messagesByAccount.indexOfKey(accountKey) >= 0) { + msgList = messagesByAccount.get(accountKey, msgList); } - if (accounts.indexOfKey(accountKey) == -1) { + if (accounts.indexOfKey(accountKey) < 0) { accounts.put(accountKey, new Pair(message.accountName, message.accountColor)); } @@ -213,7 +213,7 @@ public class ServiceSynchronize extends LifecycleService { List toRemove = new ArrayList<>(); String tag = "unseen-" + accountId; - if (notifying.indexOfKey(accountId) != -1) { + if (notifying.indexOfKey(accountId) >= 0) { toRemove = notifying.get(accountId); } @@ -539,7 +539,7 @@ public class ServiceSynchronize extends LifecycleService { List notifications = new ArrayList<>(); Integer size = messages.size(); - if (size == 0) { + if (size == 0 || account == null) { return notifications; }