fix(api): parse_expression crash with ident and curly

Problem: nvim_parse_expression null pointer dereference when parsing an
identifier followed by { with "highlight" parameter set to false.

Solution: only set opening_hl_idx if pstate->colors is not NULL.

Not added to parser_tests.lua as that uses highlight = true.
This commit is contained in:
Sean Dewar
2026-01-16 00:17:59 +00:00
parent f3cfe9a94b
commit 5226801be2
2 changed files with 7 additions and 3 deletions

View File

@@ -3238,9 +3238,11 @@ describe('API', function()
end
end
it('does not crash parsing invalid VimL expression #29648', function()
it('does not crash parsing invalid VimL expression', function()
api.nvim_input(':<C-r>=')
api.nvim_input('1bork/')
api.nvim_input('1bork/') -- #29648
assert_alive()
api.nvim_parse_expression('a{b}', '', false)
assert_alive()
end)