fix(handler): Make sure results are valid tables

This commit is contained in:
simrat39
2021-04-22 18:15:35 -07:00
parent b32435a2f5
commit 1c07dfb4bb

View File

@@ -54,6 +54,7 @@ function D._refresh()
if D.state.outline_buf ~= nil then if D.state.outline_buf ~= nil then
vim.lsp.buf_request(0, "textDocument/documentSymbol", getParams(), vim.lsp.buf_request(0, "textDocument/documentSymbol", getParams(),
function(_, _, result) function(_, _, result)
if result == nil or type(result) ~= 'table' then return end
D.state.code_win = vim.api.nvim_get_current_win() D.state.code_win = vim.api.nvim_get_current_win()
D.state.outline_items = parser.parse(result) D.state.outline_items = parser.parse(result)
@@ -170,7 +171,8 @@ local function setup_buffer()
end end
local function handler(_, _, result) local function handler(_, _, result)
if result == nil then return end if result == nil or type(result) ~= 'table' then return end
D.state.code_win = vim.api.nvim_get_current_win() D.state.code_win = vim.api.nvim_get_current_win()
setup_buffer() setup_buffer()