From f3cba25195db729f5a568f1c3c41ce14d261ddab Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 14 Aug 2024 10:30:39 +0200 Subject: [PATCH] Prevent NPE --- .../java/com/sun/mail/imap/IMAPFolder.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/sun/mail/imap/IMAPFolder.java b/app/src/main/java/com/sun/mail/imap/IMAPFolder.java index 315bbc155f..00a48f2ec4 100644 --- a/app/src/main/java/com/sun/mail/imap/IMAPFolder.java +++ b/app/src/main/java/com/sun/mail/imap/IMAPFolder.java @@ -3640,18 +3640,20 @@ public class IMAPFolder extends Folder implements UIDFolder, ResponseHandler { String uids = ir.readAtom(); eu.faircode.email.Log.w("VANISHED earlier=" + (earlier != null) + " uids=" + uids); UIDSet[] uidset = UIDSet.parseUIDSets(uids); - List msgs = new ArrayList<>(); - for (long uid : UIDSet.toArray(uidset)) { - Message m = uidTable.get(uid); - if (m != null && m.getMessageNumber() > 0) { - realTotal--; - messageCache.expungeMessage(m.getMessageNumber()); - msgs.add(m); + if (uidset != null) { + List msgs = new ArrayList<>(); + for (long uid : UIDSet.toArray(uidset)) { + Message m = uidTable.get(uid); + if (m != null && m.getMessageNumber() > 0) { + realTotal--; + messageCache.expungeMessage(m.getMessageNumber()); + msgs.add(m); + } } + if (!msgs.isEmpty() && + doExpungeNotification && hasMessageCountListener) + notifyMessageRemovedListeners(true, msgs.toArray(new Message[0])); } - if (!msgs.isEmpty() && - doExpungeNotification && hasMessageCountListener) - notifyMessageRemovedListeners(true, msgs.toArray(new Message[0])); /* String[] s = ir.readAtomStringList(); if (s == null) { // no (EARLIER)