Skip to content

Commit a756677

Browse files
Catch null pointer exception when email folder is null (#905)
1 parent 0c3464f commit a756677

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

gxmail/src/main/java/com/genexus/internet/POP3SessionJavaMail.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,10 @@ public String getNextUID() throws GXMailException {
328328

329329
public int getMessageCount() throws GXMailException {
330330
try {
331+
if (emailFolder == null || !emailFolder.isOpen())
332+
throw new GXMailException("The email folder is either null or closed", MAIL_ServerRepliedErr);
331333
if (readSinceLast)
332334
return emailFolder.getNewMessageCount();
333-
334335
return emailFolder.getMessageCount();
335336
} catch (MessagingException e) {
336337
log(e.getMessage());

0 commit comments

Comments
 (0)