mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-05 20:34:49 +01:00
Prevent crash
This commit is contained in:
@@ -236,11 +236,23 @@ public class EntityRule {
|
||||
|
||||
private void onActionMove(Context context, EntityMessage message, JSONObject jargs) throws JSONException {
|
||||
long target = jargs.getLong("target");
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
EntityFolder folder = db.folder().getFolder(target);
|
||||
if (folder == null)
|
||||
throw new IllegalArgumentException("Rule move to folder not found");
|
||||
|
||||
EntityOperation.queue(context, message, EntityOperation.MOVE, target, false);
|
||||
}
|
||||
|
||||
private void onActionCopy(Context context, EntityMessage message, JSONObject jargs) throws JSONException {
|
||||
long target = jargs.getLong("target");
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
EntityFolder folder = db.folder().getFolder(target);
|
||||
if (folder == null)
|
||||
throw new IllegalArgumentException("Rule copy to folder not found");
|
||||
|
||||
EntityOperation.queue(context, message, EntityOperation.COPY, target, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -837,15 +837,15 @@ public class FragmentRule extends FragmentBase {
|
||||
case EntityRule.TYPE_MOVE:
|
||||
case EntityRule.TYPE_COPY:
|
||||
EntityFolder target = (EntityFolder) spTarget.getSelectedItem();
|
||||
jaction.put("target", target.id);
|
||||
jaction.put("target", target == null ? -1 : target.id);
|
||||
break;
|
||||
|
||||
case EntityRule.TYPE_ANSWER:
|
||||
EntityIdentity identity = (EntityIdentity) spIdent.getSelectedItem();
|
||||
EntityAnswer answer = (EntityAnswer) spAnswer.getSelectedItem();
|
||||
boolean cc = cbCc.isChecked();
|
||||
jaction.put("identity", identity.id);
|
||||
jaction.put("answer", answer.id);
|
||||
jaction.put("identity", identity == null ? -1 : identity.id);
|
||||
jaction.put("answer", answer == null ? -1 : answer.id);
|
||||
jaction.put("cc", cc);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user