Merge pull request #1823 from slackner/fix-crash-in-field-name-for-child

Fix crash in ts_node_field_name_for_child for inline nodes
This commit is contained in:
Max Brunsfeld 2022-08-25 10:24:02 -07:00 committed by GitHub
commit 9b5e32ad76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -571,6 +571,10 @@ recur:
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,