summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWormHeamer2026-01-02 06:01:31 -0500
committerWormHeamer2026-01-02 06:01:31 -0500
commitbec1fd2771449a532366afa07e4754ffdc350d5b (patch)
tree1ea5ad86fa3da135d508e140b8bc4de74b1a7de4
parentd83cc235924cacceeea86c890a404f497a0a74de (diff)
check for non-null chunk in txt_range_equal()
-rw-r--r--txt.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/txt.c b/txt.c
index e579d7e..164bf16 100644
--- a/txt.c
+++ b/txt.c
@@ -387,9 +387,8 @@ int txt_range_equal(TxtLoc lo, TxtLoc hi, Str cmp) {
Str s = txt_next_chunk(&lo);
u32 n = cmp.n - i;
if (s.n < n) n = s.n;
- if (memcmp(s.s, cmp.s + i, n)) {
+ if (s.n > 0 && memcmp(s.s, cmp.s + i, n))
return 0;
- }
i += s.n;
}
return 1;