From b6f8dbf1ce4b9cca9c933d7c30c746686216f006 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 16 May 2022 17:35:31 +0200 Subject: [PATCH] Fix issue #54 - Crash with index --- .../main/java/app/fedilab/android/helper/SpannableHelper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 dd977e77..73d99369 100644 --- a/app/src/main/java/app/fedilab/android/helper/SpannableHelper.java +++ b/app/src/main/java/app/fedilab/android/helper/SpannableHelper.java @@ -184,8 +184,8 @@ public class SpannableHelper { if (matchEnd > content.toString().length()) { matchEnd = content.toString().length(); } - if (content.toString().length() > matchEnd) { - matchEnd = content.toString().length(); + if (content.toString().length() > matchEnd || matchStart < 0) { + continue; } final String url = content.toString().substring(matchStart, matchEnd); String newURL = Helper.transformURL(context, url);