From 0d4681cd6606015fd242f148ec213a3256a81ec7 Mon Sep 17 00:00:00 2001 From: Andrew Stadler Date: Mon, 28 Sep 2009 15:56:38 -0700 Subject: [PATCH] Catch possible NPE in IMAP sync. I don't know the root cause of the null pointer (possibly a broken connection earlier in the sync) but we shouldn't be crashing here. Fixes http://b/2135743 --- src/com/android/email/mail/store/ImapStore.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/com/android/email/mail/store/ImapStore.java b/src/com/android/email/mail/store/ImapStore.java index e150ad4da..d8a303b5a 100644 --- a/src/com/android/email/mail/store/ImapStore.java +++ b/src/com/android/email/mail/store/ImapStore.java @@ -679,8 +679,11 @@ public class ImapStore extends Store { for (Object o : fp) { if (o instanceof Part) { Part part = (Part) o; - String partId = part.getHeader(MimeHeader.HEADER_ANDROID_ATTACHMENT_STORE_DATA)[0]; - fetchFields.add("BODY.PEEK[" + partId + "]"); + String[] partIds = + part.getHeader(MimeHeader.HEADER_ANDROID_ATTACHMENT_STORE_DATA); + if (partIds != null) { + fetchFields.add("BODY.PEEK[" + partIds[0] + "]"); + } } }