Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a051e039 authored by tibbi's avatar tibbi
Browse files

catch some exceptions thrown at highlighting texts

parent d616c9dc
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -253,7 +253,10 @@ fun String.highlightTextPart(textToHighlight: String, color: Int, highlightAll:


    indexes.forEach {
    indexes.forEach {
        val endIndex = Math.min(it + textToHighlight.length, length)
        val endIndex = Math.min(it + textToHighlight.length, length)
        try {
            spannableString.setSpan(ForegroundColorSpan(color), it, endIndex, Spannable.SPAN_EXCLUSIVE_INCLUSIVE)
            spannableString.setSpan(ForegroundColorSpan(color), it, endIndex, Spannable.SPAN_EXCLUSIVE_INCLUSIVE)
        } catch (ignored: IndexOutOfBoundsException) {
        }
    }
    }


    return spannableString
    return spannableString