From 9f7b4471812a975930cffb692a9e19b81faaff8f Mon Sep 17 00:00:00 2001 From: cketti Date: Wed, 1 Dec 2010 18:14:12 +0000 Subject: [PATCH] POP3: Ignore messages without unique-id when parsing UIDL response Fixes issue 2731 --- src/com/fsck/k9/mail/store/Pop3Store.java | 33 +++++++++++++---------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/com/fsck/k9/mail/store/Pop3Store.java b/src/com/fsck/k9/mail/store/Pop3Store.java index 0abd35286..59e6abea0 100644 --- a/src/com/fsck/k9/mail/store/Pop3Store.java +++ b/src/com/fsck/k9/mail/store/Pop3Store.java @@ -596,21 +596,26 @@ public class Pop3Store extends Store break; } String[] uidParts = response.split(" "); - Integer msgNum = Integer.valueOf(uidParts[0]); - String msgUid = uidParts[1]; - if (unindexedUids.contains(msgUid)) - { - if (K9.DEBUG && K9.DEBUG_PROTOCOL_POP3) - { - Log.d(K9.LOG_TAG, "Got msgNum " + msgNum + " for UID " + msgUid); - } - Pop3Message message = mUidToMsgMap.get(msgUid); - if (message == null) - { - message = new Pop3Message(msgUid, this); - } - indexMessage(msgNum, message); + // Ignore messages without a unique-id + if (uidParts.length >= 2) + { + Integer msgNum = Integer.valueOf(uidParts[0]); + String msgUid = uidParts[1]; + if (unindexedUids.contains(msgUid)) + { + if (K9.DEBUG && K9.DEBUG_PROTOCOL_POP3) + { + Log.d(K9.LOG_TAG, "Got msgNum " + msgNum + " for UID " + msgUid); + } + + Pop3Message message = mUidToMsgMap.get(msgUid); + if (message == null) + { + message = new Pop3Message(msgUid, this); + } + indexMessage(msgNum, message); + } } } }