aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Winston2024-07-23 19:11:38 -0400
committerBen Winston2024-07-23 19:11:38 -0400
commitafe32dfe3c3294ff12a9c39d1294cd2db66b5ec8 (patch)
tree8e49487cbe970559055b393bfbb3366bc57bae24
parent2ba9fc01bd1f1f54b50004c97d7239a469dd6f19 (diff)
bugfix: don't match on empty text
-rw-r--r--booki.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/booki.c b/booki.c
index efec71a..8f9af6d 100644
--- a/booki.c
+++ b/booki.c
@@ -745,6 +745,9 @@ bool match_string(const char* pattern, const ES text) {
// empty pattern matches everything
if (!*pattern) return true;
+ // empty text matches nothing
+ if (text.len == 0) return false;
+
// get lengths
int pattern_length = strlen(pattern);