mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-18 21:28:54 +00:00
Prevent cast exception
This commit is contained in:
parent
dbb1cc1303
commit
194045c92c
1 changed files with 10 additions and 1 deletions
|
@ -971,7 +971,16 @@ public class MessageHelper {
|
||||||
private void getMessageParts(Part part, MessageParts parts, boolean pgp) throws IOException, FolderClosedException {
|
private void getMessageParts(Part part, MessageParts parts, boolean pgp) throws IOException, FolderClosedException {
|
||||||
try {
|
try {
|
||||||
if (part.isMimeType("multipart/*")) {
|
if (part.isMimeType("multipart/*")) {
|
||||||
Multipart multipart = (Multipart) part.getContent();
|
Multipart multipart;
|
||||||
|
final Object content = part.getContent();
|
||||||
|
if (content instanceof Multipart)
|
||||||
|
multipart = (Multipart) part.getContent();
|
||||||
|
else {
|
||||||
|
String text = (String) content;
|
||||||
|
String sample = text.substring(0, Math.min(80, text.length()));
|
||||||
|
throw new ParseException(content.getClass().getName() + ": " + sample);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < multipart.getCount(); i++)
|
for (int i = 0; i < multipart.getCount(); i++)
|
||||||
try {
|
try {
|
||||||
Part cpart = multipart.getBodyPart(i);
|
Part cpart = multipart.getBodyPart(i);
|
||||||
|
|
Loading…
Reference in a new issue