From 7bab6a0a66bd8038a73d57e2a02c3bbc8f5c1685 Mon Sep 17 00:00:00 2001 From: mguessan Date: Wed, 17 Nov 2010 23:17:58 +0000 Subject: [PATCH] IMAP: fix nullpointerException in header fetch git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1545 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- src/java/davmail/imap/ImapConnection.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/java/davmail/imap/ImapConnection.java b/src/java/davmail/imap/ImapConnection.java index 9d3ecc77..5d99d47d 100644 --- a/src/java/davmail/imap/ImapConnection.java +++ b/src/java/davmail/imap/ImapConnection.java @@ -796,12 +796,16 @@ public class ImapConnection extends AbstractConnection { } protected String[] getRequestedHeaders(String partIndexString) { - int startIndex = partIndexString.indexOf('('); - int endIndex = partIndexString.indexOf(')'); - if (startIndex >= 0 && endIndex >= 0) { - return partIndexString.substring(startIndex + 1, endIndex - 1).split(" "); - } else { + if (partIndexString == null) { return null; + } else { + int startIndex = partIndexString.indexOf('('); + int endIndex = partIndexString.indexOf(')'); + if (startIndex >= 0 && endIndex >= 0) { + return partIndexString.substring(startIndex + 1, endIndex - 1).split(" "); + } else { + return null; + } } }