Skip to content

Commit

Permalink
Catch null pointer exception when email folder is null (#905)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomas-sexenian authored Nov 18, 2024
1 parent 0c3464f commit a756677
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit a756677

Please sign in to comment.