From bfc8471360f6d27bf92c7959746bd8dd33feed31 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 22 Jun 2021 22:07:19 +0200 Subject: [PATCH] Prevent crash --- .../eu/faircode/email/ActivityCompose.java | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ActivityCompose.java b/app/src/main/java/eu/faircode/email/ActivityCompose.java index 08aa0571bb..ce200a6cce 100644 --- a/app/src/main/java/eu/faircode/email/ActivityCompose.java +++ b/app/src/main/java/eu/faircode/email/ActivityCompose.java @@ -95,19 +95,13 @@ public class ActivityCompose extends ActivityBase implements FragmentManager.OnB // https://www.ietf.org/rfc/rfc2368.txt MailTo mailto = MailTo.parse(uri.toString()); - String _to = mailto.getTo(); - if (_to != null) { - List to = sanitize(new String[]{_to}); - if (to.size() == 1) - args.putString("to", to.get(0)); - } + List to = sanitize(new String[]{mailto.getTo()}); + if (to.size() == 1) + args.putString("to", to.get(0)); - String _cc = mailto.getCc(); - if (_cc != null) { - List cc = sanitize(new String[]{_cc}); - if (cc.size() == 1) - args.putString("cc", cc.get(0)); - } + List cc = sanitize(new String[]{mailto.getCc()}); + if (cc.size() == 1) + args.putString("cc", cc.get(0)); String subject = mailto.getSubject(); if (subject != null) @@ -220,6 +214,8 @@ public class ActivityCompose extends ActivityBase implements FragmentManager.OnB List result = new ArrayList<>(); if (addresses != null) for (String address : addresses) { + if (!TextUtils.isEmpty(address)) + continue; address = address.replaceAll("\\s+", ""); address = address.replaceAll("\u200b", ""); // Discord: zero width space if (!TextUtils.isEmpty(address))