From: Damyan Ivanov Date: Thu, 18 Feb 2021 19:08:17 +0000 (+0200) Subject: fix crash when there is no test text and the pattern is tested X-Git-Tag: v0.17.0~84 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=d9a211a52d38f24b19bf5c2d6918d2efec858a15;p=mobile-ledger.git fix crash when there is no test text and the pattern is tested --- 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