]> git.ktnx.net Git - mobile-ledger.git/commitdiff
fix crash when there is no test text and the pattern is tested
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 18 Feb 2021 19:08:17 +0000 (21:08 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 18 Feb 2021 19:08:17 +0000 (21:08 +0200)
app/src/main/java/net/ktnx/mobileledger/model/TemplateDetailsItem.java

index 2eb3346df313e6c9ae040e84e05aa594d1856064..740806813b09456e149a798093921b4a8b36f522 100644 (file)
@@ -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