Fixed crash on attachment in some cases

pull/145/head
M66B 6 years ago
parent 350fbdf486
commit ce57552886

@ -390,10 +390,10 @@ public class FragmentCompose extends FragmentEx {
draftLoader.load(this, args); draftLoader.load(this, args);
} }
} else { } else {
long id = savedInstanceState.getLong("working"); working = savedInstanceState.getLong("working");
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putString("action", id < 0 ? "new" : "edit"); args.putString("action", working < 0 ? "new" : "edit");
args.putLong("id", id); args.putLong("id", working);
args.putLong("account", -1); args.putLong("account", -1);
args.putLong("reference", -1); args.putLong("reference", -1);
args.putLong("answer", -1); args.putLong("answer", -1);
@ -692,7 +692,7 @@ public class FragmentCompose extends FragmentEx {
db.beginTransaction(); db.beginTransaction();
EntityMessage draft = db.message().getMessage(id); EntityMessage draft = db.message().getMessage(id);
Log.i(Helper.TAG, "Attaching to id=" + draft.id); Log.i(Helper.TAG, "Attaching to id=" + id);
attachment.message = draft.id; attachment.message = draft.id;
attachment.sequence = db.attachment().getAttachmentCount(draft.id) + 1; attachment.sequence = db.attachment().getAttachmentCount(draft.id) + 1;

Loading…
Cancel
Save