1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 19:52:17 -05:00

Bulletproofing against running IMAP Copy/Move commands with null messagelists. Fixes Issue 914

This commit is contained in:
Jesse Vincent 2009-12-15 17:40:04 +00:00
parent 87c8599504
commit dc2f752f11

View File

@ -698,6 +698,10 @@ public class ImapStore extends Store
{ {
throw new MessagingException("ImapFolder.copyMessages passed non-ImapFolder"); throw new MessagingException("ImapFolder.copyMessages passed non-ImapFolder");
} }
if (messages.length == 0)
return;
ImapFolder iFolder = (ImapFolder)folder; ImapFolder iFolder = (ImapFolder)folder;
checkOpen(); checkOpen();
String[] uids = new String[messages.length]; String[] uids = new String[messages.length];
@ -720,12 +724,17 @@ public class ImapStore extends Store
@Override @Override
public void moveMessages(Message[] messages, Folder folder) throws MessagingException public void moveMessages(Message[] messages, Folder folder) throws MessagingException
{ {
if (messages.length == 0)
return;
copyMessages(messages, folder); copyMessages(messages, folder);
setFlags(messages, new Flag[] { Flag.DELETED }, true); setFlags(messages, new Flag[] { Flag.DELETED }, true);
} }
public void delete(Message[] messages, String trashFolderName) throws MessagingException public void delete(Message[] messages, String trashFolderName) throws MessagingException
{ {
if (messages.length == 0)
return;
if (getName().equals(trashFolderName)) if (getName().equals(trashFolderName))
{ {
setFlags(messages, new Flag[] { Flag.DELETED }, true); setFlags(messages, new Flag[] { Flag.DELETED }, true);