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

(cherry picked from commit 31b9717ca3)
This commit is contained in:
Will Lillis 2025-05-04 00:12:44 -04:00 committed by Christian Clason
parent 69723ca40e
commit b0a6bde2fb

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];
}