]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/model/TemplateDetailsItem.java
fix crash when there is no test text and the pattern is tested
[mobile-ledger.git] / 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