diff --git a/gxmail/src/main/java/com/genexus/internet/POP3SessionJavaMail.java b/gxmail/src/main/java/com/genexus/internet/POP3SessionJavaMail.java index a50d5475b..cd8d23c5d 100644 --- a/gxmail/src/main/java/com/genexus/internet/POP3SessionJavaMail.java +++ b/gxmail/src/main/java/com/genexus/internet/POP3SessionJavaMail.java @@ -328,9 +328,10 @@ public String getNextUID() throws GXMailException { public int getMessageCount() throws GXMailException { try { + if (emailFolder == null || !emailFolder.isOpen()) + throw new GXMailException("The email folder is either null or closed", MAIL_ServerRepliedErr); if (readSinceLast) return emailFolder.getNewMessageCount(); - return emailFolder.getMessageCount(); } catch (MessagingException e) { log(e.getMessage());