mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	fix(lua): pop retval for fast context LuaRef
Problem:  nlua_call_ref_ctx() does not pop the return value in fast
          context that did not error.
Solution: Fall through to end; calling nlua_call_pop_retval().
			
			
This commit is contained in:
		@@ -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;
 | 
			
		||||
    }
 | 
			
		||||
  } else if (nlua_pcall(lstate, nargs, 1)) {
 | 
			
		||||
    // if err is passed, the caller will deal with the error.
 | 
			
		||||
    if (err) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user