From 785257cc6cbc5b0ed10d505efb09f852fb2da3dd Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 4 Jan 2023 11:12:17 +0100 Subject: [PATCH] Fix potential crashes --- .../main/java/app/fedilab/android/helper/SpannableHelper.java | 3 +++ .../app/fedilab/android/ui/drawer/NotificationAdapter.java | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) 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 2ddf9a6f..b75b5d3c 100644 --- a/app/src/main/java/app/fedilab/android/helper/SpannableHelper.java +++ b/app/src/main/java/app/fedilab/android/helper/SpannableHelper.java @@ -143,6 +143,9 @@ public class SpannableHelper { int start = content.getSpanStart(span); int end = content.getSpanEnd(span); + if (start < 0 || end > content.length()) { + continue; + } content.removeSpan(span); //Get the matching word associated to the URL String word = content.subSequence(start, end).toString(); diff --git a/app/src/main/java/app/fedilab/android/ui/drawer/NotificationAdapter.java b/app/src/main/java/app/fedilab/android/ui/drawer/NotificationAdapter.java index 932d6e08..3ecbc651 100644 --- a/app/src/main/java/app/fedilab/android/ui/drawer/NotificationAdapter.java +++ b/app/src/main/java/app/fedilab/android/ui/drawer/NotificationAdapter.java @@ -313,7 +313,7 @@ public class NotificationAdapter extends RecyclerView.Adapter