Check for nil before checking for empty table

At least the `gopls` language server seems to return nil/null if no code
actions are available. Currently this results in an error:

> Error executing vim.schedule lua callback: shared.lua:199: Expected table, got nil
This commit is contained in:
Andy Lindeman 2020-05-15 21:34:28 -04:00
parent f559e5249e
commit 986bed2329

View File

@ -19,7 +19,7 @@ M['workspace/executeCommand'] = function(err, _)
end
M['textDocument/codeAction'] = function(_, _, actions)
if vim.tbl_isempty(actions) then
if actions == nil or vim.tbl_isempty(actions) then
print("No code actions available")
return
end