From d9a211a52d38f24b19bf5c2d6918d2efec858a15 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Thu, 18 Feb 2021 21:08:17 +0200 Subject: [PATCH] fix crash when there is no test text and the pattern is tested --- .../net/ktnx/mobileledger/model/TemplateDetailsItem.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/net/ktnx/mobileledger/model/TemplateDetailsItem.java b/app/src/main/java/net/ktnx/mobileledger/model/TemplateDetailsItem.java index 2eb3346d..74080681 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/TemplateDetailsItem.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/TemplateDetailsItem.java @@ -500,8 +500,9 @@ abstract public class TemplateDetailsItem { compiledPattern = null; testMatch = new SpannableString(testText); - testMatch.setSpan(notMatchedSpan(), 0, testText.length() - 1, - Spanned.SPAN_INCLUSIVE_INCLUSIVE); + if (!testText.isEmpty()) + testMatch.setSpan(notMatchedSpan(), 0, testText.length() - 1, + Spanned.SPAN_INCLUSIVE_INCLUSIVE); } } @NonNull -- 2.39.5