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
This commit is contained in:
Andrew Stadler 2009-09-28 15:56:38 -07:00
parent 0f7542e714
commit 0d4681cd66

View File

@ -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] + "]");
}
}
}