From 7ae933a05134a62dc068096ee5288747f855393d Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 24 Jan 2020 14:20:24 +0100 Subject: [PATCH] Prevent exception --- app/src/main/java/eu/faircode/email/EditTextCompose.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/EditTextCompose.java b/app/src/main/java/eu/faircode/email/EditTextCompose.java index 7712c0bdd8..0162705b6a 100644 --- a/app/src/main/java/eu/faircode/email/EditTextCompose.java +++ b/app/src/main/java/eu/faircode/email/EditTextCompose.java @@ -72,8 +72,12 @@ public class EditTextCompose extends AppCompatEditText { ClipData.Item item = clipboard.getPrimaryClip().getItemAt(0); String html = item.getHtmlText(); - if (html == null) - html = "
" + HtmlHelper.formatPre(item.getText().toString()) + "
"; + if (html == null) { + CharSequence text = item.getText(); + if (text == null) + return false; + html = "
" + HtmlHelper.formatPre(text.toString()) + "
"; + } Document document = HtmlHelper.sanitize(context, html, false, false); Spanned paste = HtmlHelper.fromHtml(document.html());