From 4f07e2e60abd88f7c7da97076fc8333b686cf475 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 26 Sep 2019 10:32:27 +0200 Subject: [PATCH] Prevent crash --- .../java/eu/faircode/email/FragmentMessages.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index 561040d087..8b596c294c 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -778,12 +778,16 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. @Override protected void onExecuted(Bundle args, EntityFolder drafts) { - LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext()); - lbm.sendBroadcast( - new Intent(ActivityView.ACTION_VIEW_MESSAGES) - .putExtra("account", drafts.account) - .putExtra("folder", drafts.id) - .putExtra("type", drafts.type)); + if (drafts == null) + Snackbar.make(view, R.string.title_no_primary_drafts, Snackbar.LENGTH_LONG).show(); + else { + LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext()); + lbm.sendBroadcast( + new Intent(ActivityView.ACTION_VIEW_MESSAGES) + .putExtra("account", drafts.account) + .putExtra("folder", drafts.id) + .putExtra("type", drafts.type)); + } } @Override