diff options
-rw-r--r-- | src/nvim/lua/executor.c | 2 | ||||
-rw-r--r-- | test/functional/lua/ui_event_spec.lua | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index a5b48a5d5e..71c5cd4585 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -1587,8 +1587,8 @@ Object nlua_call_ref_ctx(bool fast, LuaRef ref, const char *name, Array args, Lu if (nlua_fast_cfpcall(lstate, nargs, 1, -1) < 0) { // error is already scheduled, set anyways to convey failure. api_set_error(err, kErrorTypeException, "fast context failure"); + return NIL; } - return NIL; } else if (nlua_pcall(lstate, nargs, 1)) { // if err is passed, the caller will deal with the error. if (err) { diff --git a/test/functional/lua/ui_event_spec.lua b/test/functional/lua/ui_event_spec.lua index 8bfd574fb9..80457555d4 100644 --- a/test/functional/lua/ui_event_spec.lua +++ b/test/functional/lua/ui_event_spec.lua @@ -423,4 +423,13 @@ describe('vim.ui_attach', function() {100:Press ENTER or type command to continue}^ | ]]) end) + + it('sourcing invalid file does not crash #32166', function() + exec_lua([[ + local ns = vim.api.nvim_create_namespace("") + vim.ui_attach(ns, { ext_messages = true }, function() end) + ]]) + feed((':luafile %s<CR>'):format(testlog)) + n.assert_alive() + end) end) |