mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	fix(lsp): check for nil response from server (#29196)
this only changes the error message, so that it is clear that the error is with the LSP server, rather than being a crash inside nvim runtime scripts. We are already doing a lot of validation, it's just that nil was being overlooked here. This fixes issue #27395
This commit is contained in:
		| @@ -407,7 +407,9 @@ function Client:handle_body(body) | ||||
|   end | ||||
|   log.debug('rpc.receive', decoded) | ||||
|  | ||||
|   if type(decoded.method) == 'string' and decoded.id then | ||||
|   if type(decoded) ~= 'table' then | ||||
|     self:on_error(M.client_errors.INVALID_SERVER_MESSAGE, decoded) | ||||
|   elseif type(decoded.method) == 'string' and decoded.id then | ||||
|     local err --- @type lsp.ResponseError|nil | ||||
|     -- Schedule here so that the users functions don't trigger an error and | ||||
|     -- we can still use the result. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Tama McGlinn
					Tama McGlinn