diff --git a/lib/src/node.c b/lib/src/node.c index 0e141136..203b98c8 100644 --- a/lib/src/node.c +++ b/lib/src/node.c @@ -348,6 +348,9 @@ static inline TSNode ts_node__descendant_for_byte_range( uint32_t range_end, bool include_anonymous ) { + if (range_start > range_end) { + return ts_node__null(); + } TSNode node = self; TSNode last_visible_node = self; @@ -391,6 +394,9 @@ static inline TSNode ts_node__descendant_for_point_range( TSPoint range_end, bool include_anonymous ) { + if (point_gt(range_start, range_end)) { + return ts_node__null(); + } TSNode node = self; TSNode last_visible_node = self;