Prevent exception

pull/172/head
M66B 6 years ago
parent 5fc5f23bc7
commit 7ae933a051

@ -72,8 +72,12 @@ public class EditTextCompose extends AppCompatEditText {
ClipData.Item item = clipboard.getPrimaryClip().getItemAt(0);
String html = item.getHtmlText();
if (html == null)
html = "<div>" + HtmlHelper.formatPre(item.getText().toString()) + "</div>";
if (html == null) {
CharSequence text = item.getText();
if (text == null)
return false;
html = "<div>" + HtmlHelper.formatPre(text.toString()) + "</div>";
}
Document document = HtmlHelper.sanitize(context, html, false, false);
Spanned paste = HtmlHelper.fromHtml(document.html());

Loading…
Cancel
Save