Make ts_language_field_name_for_id return NULL for out-of-bound id

This commit is contained in:
Tuấn-Anh Nguyễn 2020-02-27 21:09:20 +07:00
parent a578ba54c4
commit c719e24a45
2 changed files with 8 additions and 5 deletions

View file

@ -119,7 +119,7 @@ const char *ts_language_field_name_for_id(
TSFieldId id
) {
uint32_t count = ts_language_field_count(self);
if (count) {
if (count && id <= count) {
return self->field_names[id];
} else {
return NULL;