From 42c22a4c05ab1311f5dbf46513203c4cbc45280a Mon Sep 17 00:00:00 2001
From: Stephen Paul Weber <singpolyma@singpolyma.net>
Date: Mon, 18 Nov 2024 10:15:12 -0500
Subject: [PATCH] This should never happen but crash logs say it do

Not colouring is better than crashing

(cherry picked from commit 3725dba15881df3fe7c26c40204bf48f8d8d02b0)
---
 .../siacs/conversations/utils/IrregularUnicodeDetector.java   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/main/java/eu/siacs/conversations/utils/IrregularUnicodeDetector.java b/src/main/java/eu/siacs/conversations/utils/IrregularUnicodeDetector.java
index 5cc093249..970ae046d 100644
--- a/src/main/java/eu/siacs/conversations/utils/IrregularUnicodeDetector.java
+++ b/src/main/java/eu/siacs/conversations/utils/IrregularUnicodeDetector.java
@@ -94,7 +94,9 @@ public class IrregularUnicodeDetector {
 			String[] labels = jid.getDomain().toEscapedString().split("\\.");
 			for (int i = 0; i < labels.length; ++i) {
 				SpannableString spannableString = new SpannableString(labels[i]);
-				colorize(spannableString, patternTuple.domain.get(i), color);
+				if (patternTuple.domain.size() > i) {
+					colorize(spannableString, patternTuple.domain.get(i), color);
+				}
 				if (i != 0) {
 					builder.append('.');
 				}