fix(highlight): fix the seg fault caused by the invalid linked hl ids

This commit is contained in:
William Wong
2024-08-13 16:25:29 +08:00
committed by Lewis Russell
parent 9d74dc3ac5
commit 6bcefad5a6
2 changed files with 3 additions and 1 deletions

View File

@@ -1648,6 +1648,7 @@ static bool hlgroup2dict(Dictionary *hl, NS ns_id, int hl_id, Arena *arena)
PUT_C(*hl, "default", BOOLEAN_OBJ(true));
}
if (link > 0) {
assert(1 <= link && link <= highlight_ga.ga_len);
PUT_C(*hl, "link", CSTR_AS_OBJ(hl_table[link - 1].sg_name));
}
Dictionary hl_cterm = arena_dict(arena, HLATTRS_DICT_SIZE);