From de80c5b914f784a8bb035cedf7e51e081eb50d2b Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 16 May 2022 17:33:22 +0200 Subject: [PATCH] Fix issue #55 - Crash with index position for URLs --- .../main/java/app/fedilab/android/helper/SpannableHelper.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/java/app/fedilab/android/helper/SpannableHelper.java b/app/src/main/java/app/fedilab/android/helper/SpannableHelper.java index 368bcd9f..dd977e77 100644 --- a/app/src/main/java/app/fedilab/android/helper/SpannableHelper.java +++ b/app/src/main/java/app/fedilab/android/helper/SpannableHelper.java @@ -184,6 +184,9 @@ public class SpannableHelper { if (matchEnd > content.toString().length()) { matchEnd = content.toString().length(); } + if (content.toString().length() > matchEnd) { + matchEnd = content.toString().length(); + } final String url = content.toString().substring(matchStart, matchEnd); String newURL = Helper.transformURL(context, url); //If URL has been transformed