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 authored and lolo101 committed Oct 18, 2023
1 parent 0350d53 commit 338eedc
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 338eedc

Please sign in to comment.