Small improvement

This commit is contained in:
M66B 2022-04-25 11:56:22 +02:00
parent c16d9c0c89
commit 081d0a2d90
1 changed files with 28 additions and 26 deletions

View File

@ -752,7 +752,8 @@ public class FragmentCompose extends FragmentBase {
added = null; added = null;
} }
if (removed != null) { if (removed != null)
try {
ParagraphStyle[] ps = text.getSpans(removed, removed + 1, ParagraphStyle.class); ParagraphStyle[] ps = text.getSpans(removed, removed + 1, ParagraphStyle.class);
if (ps != null) if (ps != null)
for (ParagraphStyle p : ps) { for (ParagraphStyle p : ps) {
@ -763,11 +764,12 @@ public class FragmentCompose extends FragmentBase {
} }
StyleHelper.renumber(text, true, etBody.getContext()); StyleHelper.renumber(text, true, etBody.getContext());
} finally {
removed = null; removed = null;
} }
if (translated != null) { if (translated != null)
try {
StyleHelper.TranslatedSpan[] spans = StyleHelper.TranslatedSpan[] spans =
text.getSpans(translated, translated, StyleHelper.TranslatedSpan.class); text.getSpans(translated, translated, StyleHelper.TranslatedSpan.class);
for (StyleHelper.TranslatedSpan span : spans) { for (StyleHelper.TranslatedSpan span : spans) {
@ -778,7 +780,7 @@ public class FragmentCompose extends FragmentBase {
text.removeSpan(span); text.removeSpan(span);
} }
} }
} finally {
translated = null; translated = null;
} }