diff --git a/app/src/main/java/eu/faircode/email/MailService.java b/app/src/main/java/eu/faircode/email/MailService.java index 31dc2583a4..4b66e2ac66 100644 --- a/app/src/main/java/eu/faircode/email/MailService.java +++ b/app/src/main/java/eu/faircode/email/MailService.java @@ -348,7 +348,8 @@ public class MailService implements AutoCloseable { } else throw new NoSuchProviderException(protocol); } catch (MessagingException ex) { - if (ex.getCause() instanceof SSLHandshakeException && + if (factory != null && + ex.getCause() instanceof SSLHandshakeException && ex.getCause().getCause() instanceof CertificateException) throw new UntrustedException(factory.getFingerPrint(), ex); else