From f09c92a14a2989293c314317a54f6423420e5075 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 21 Mar 2023 18:45:27 +0100 Subject: [PATCH] Thread safe toHtml (2) --- app/src/main/java/eu/faircode/email/HtmlEx.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/HtmlEx.java b/app/src/main/java/eu/faircode/email/HtmlEx.java index e5cbe59ea6..461ebe6125 100644 --- a/app/src/main/java/eu/faircode/email/HtmlEx.java +++ b/app/src/main/java/eu/faircode/email/HtmlEx.java @@ -76,9 +76,10 @@ public class HtmlEx { * @return string containing input converted to HTML */ public /* static */ String toHtml(Spanned text, int option) { - SpannableStringBuilder ssb = new SpannableStringBuilderEx(text); + if (!Helper.isUiThread()) + text = new SpannableStringBuilderEx(text); StringBuilder out = new StringBuilder(); - withinHtml(out, ssb, option); + withinHtml(out, text, option); return out.toString(); }