Skip to content

Commit ef43d49

Browse files
committed
Added debug code for detect when we receive NPE while moving a message.| #122.
1 parent 52cb062 commit ef43d49

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

FlowCrypt/src/main/java/com/flowcrypt/email/service/EmailSyncService.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,23 @@ public void handleMessage(Message message) {
639639
com.flowcrypt.email.api.email.Folder[] folders = (com.flowcrypt.email
640640
.api.email.Folder[]) action.getObject();
641641

642+
String emailDomain = emailSyncManager.getAccountDao().getAccountType();
643+
644+
if (folders == null || folders.length != 2) {
645+
throw new IllegalArgumentException(emailDomain + "| Cannot move the message. Folders " +
646+
"are null.");
647+
}
648+
649+
if (folders[0] == null) {
650+
throw new IllegalArgumentException(emailDomain + "| Cannot move the message. The " +
651+
"source folder is null.");
652+
}
653+
654+
if (folders[1] == null) {
655+
throw new IllegalArgumentException(emailDomain + "| Cannot move the message. The " +
656+
"destination folder is null.");
657+
}
658+
642659
emailSyncManager.moveMessage(action.getOwnerKey(), action.getRequestCode(),
643660
folders[0].getServerFullFolderName(), folders[1].getServerFullFolderName(),
644661
message.arg1);

0 commit comments

Comments
 (0)