diff --git a/src/main/java/pt/cjmach/pstconv/PstConverter.java b/src/main/java/pt/cjmach/pstconv/PstConverter.java index e0650e9..1450c4f 100644 --- a/src/main/java/pt/cjmach/pstconv/PstConverter.java +++ b/src/main/java/pt/cjmach/pstconv/PstConverter.java @@ -442,10 +442,11 @@ void convertAttachments(PSTMessage message, MimeMultipart rootMultipart) throws if (attachment != null) { byte[] data = getAttachmentBytes(attachment); - if (data.length == 0) { + if (data == null) { logger.warn("Failed to extract bytes of attachment {} from message {}.", attachment.getDescriptorNodeId(), message.getDescriptorNodeId()); // try to add the attachment, which may still be useful even without its contents. + data = new byte[0]; } MimeBodyPart attachmentBodyPart = new MimeBodyPart(); @@ -495,7 +496,7 @@ static byte[] getAttachmentBytes(PSTAttachment attachment) throws PSTException, try { input = attachment.getFileInputStream(); } catch (NullPointerException ex) { - return new byte[0]; + return null; } try { int nread;