fix(lib): return early for empty predicate step slice

This commit is contained in:
Will Lillis 2025-05-04 00:12:44 -04:00
parent 52a792384f
commit 31b9717ca3

View file

@ -2978,9 +2978,7 @@ const TSQueryPredicateStep *ts_query_predicates_for_pattern(
) {
Slice slice = self->patterns.contents[pattern_index].predicate_steps;
*step_count = slice.length;
if (self->predicate_steps.contents == NULL) {
return NULL;
}
if (slice.length == 0) return NULL;
return &self->predicate_steps.contents[slice.offset];
}