Fix OOB in Query::new

This commit is contained in:
Samuel Moelius 2023-05-19 21:31:26 -04:00
parent 67f4f2328c
commit f461d953a6

View file

@ -1401,7 +1401,7 @@ impl Query {
let suffix = source.split_at(offset).1;
let end_offset = suffix
.find(|c| !char::is_alphanumeric(c) && c != '_' && c != '-')
.unwrap_or(source.len());
.unwrap_or(suffix.len());
message = suffix.split_at(end_offset).0.to_string();
kind = match error_type {
ffi::TSQueryError_TSQueryErrorNodeType => QueryErrorKind::NodeType,