Skip to content

Commit

Permalink
Fixed NullPointerException when attachment hasn't filename attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Cybso committed Oct 12, 2023
1 parent 0350d53 commit 2911bf1
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ private static void parse(Message msg, Part part) throws MessagingException, IOE
MimePart mpart = (MimePart) part;

FileAttachment att = new FileAttachment();
String filename = MimeUtility.decodeText(part.getFileName());
String filename = part.getFileName();
if (filename != null) {
filename = MimeUtility.decodeText(filename);
} else {
filename = "unknown";
}
att.setMimeTag(getMime(part.getContentType()));
att.setLongFilename(filename);

Expand Down

0 comments on commit 2911bf1

Please sign in to comment.