diff --git a/app/src/main/java/eu/faircode/email/StyleHelper.java b/app/src/main/java/eu/faircode/email/StyleHelper.java index 1b49dbb1f6..b714e79921 100644 --- a/app/src/main/java/eu/faircode/email/StyleHelper.java +++ b/app/src/main/java/eu/faircode/email/StyleHelper.java @@ -351,6 +351,9 @@ public class StyleHelper { Log.breadcrumb("style", "action", "alignment"); Pair paragraph = ensureParagraph(edit, start, end); + if (paragraph == null) + return false; + int s = paragraph.first; int e = paragraph.second; @@ -421,6 +424,9 @@ public class StyleHelper { float textSize = Helper.getTextSize(context, 0) * message_zoom / 100f; Pair paragraph = ensureParagraph(edit, start, end); + if (paragraph == null) + return false; + int s = paragraph.first; int e = paragraph.second; @@ -494,6 +500,8 @@ public class StyleHelper { int quoteStripe = context.getResources().getDimensionPixelSize(R.dimen.quote_stripe_width); Pair paragraph = ensureParagraph(edit, start, end); + if (paragraph == null) + return false; QuoteSpan q; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) @@ -680,6 +688,8 @@ public class StyleHelper { else if (span instanceof QuoteSpan) { ParagraphStyle ps = (ParagraphStyle) span; Pair p = ensureParagraph(edit, start, end); + if (p == null) + return; edit.setSpan(clone(span, ps.getClass(), context), p.first, p.second, flags); } }