Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash in ts_node_field_name_for_child for inline nodes #1823

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/src/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,10 @@ TSNode ts_node_child_by_field_id(TSNode self, TSFieldId field_id) {

const char *ts_node_field_name_for_child(TSNode self, uint32_t child_index) {
const TSFieldMapEntry *field_map_start = NULL, *field_map_end = NULL;
if (!ts_node_child_count(self)) {
return NULL;
}

ts_language_field_map(
self.tree->language,
ts_node__subtree(self).ptr->production_id,
Expand Down