From dc2f752f11ded6aa7662bfaed217a164962f2a70 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Tue, 15 Dec 2009 17:40:04 +0000 Subject: [PATCH] Bulletproofing against running IMAP Copy/Move commands with null messagelists. Fixes Issue 914 --- src/com/fsck/k9/mail/store/ImapStore.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/com/fsck/k9/mail/store/ImapStore.java b/src/com/fsck/k9/mail/store/ImapStore.java index 9eb80e50b..f897a1e36 100644 --- a/src/com/fsck/k9/mail/store/ImapStore.java +++ b/src/com/fsck/k9/mail/store/ImapStore.java @@ -698,6 +698,10 @@ public class ImapStore extends Store { throw new MessagingException("ImapFolder.copyMessages passed non-ImapFolder"); } + + if (messages.length == 0) + return; + ImapFolder iFolder = (ImapFolder)folder; checkOpen(); String[] uids = new String[messages.length]; @@ -720,12 +724,17 @@ public class ImapStore extends Store @Override public void moveMessages(Message[] messages, Folder folder) throws MessagingException { + if (messages.length == 0) + return; copyMessages(messages, folder); setFlags(messages, new Flag[] { Flag.DELETED }, true); } public void delete(Message[] messages, String trashFolderName) throws MessagingException { + if (messages.length == 0) + return; + if (getName().equals(trashFolderName)) { setFlags(messages, new Flag[] { Flag.DELETED }, true);