Added extra check

This commit is contained in:
M66B 2021-04-24 19:46:21 +02:00
parent 3bff0b11a8
commit 80f333d969
1 changed files with 11 additions and 3 deletions

View File

@ -648,9 +648,17 @@ class Core {
Long uid = findUid(context, ifolder, message.msgid, false);
if (uid == null) {
if (EntityFolder.DRAFTS.equals(folder.type) &&
EntityOperation.MOVE.equals(op.name))
if (EntityOperation.MOVE.equals(op.name) &&
EntityFolder.DRAFTS.equals(folder.type))
try {
long fid = new JSONArray(op.args).optLong(0, -1L);
EntityFolder target = db.folder().getFolder(fid);
if (target != null && EntityFolder.TRASH.equals(folder.type))
db.message().deleteMessage(message.id);
} catch (JSONException ex) {
Log.e(ex);
}
throw new IllegalArgumentException("Message not found for " + op.name + " folder=" + folder.name);
}