From ec03b3cc4ba16e6411f35f15230e1e4e776ebe3d Mon Sep 17 00:00:00 2001 From: Michael Paulson Date: Mon, 4 Dec 2023 17:41:27 -0700 Subject: [PATCH] fix: active list caused nil access error --- lua/harpoon/ui.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lua/harpoon/ui.lua b/lua/harpoon/ui.lua index 375d5e6..8da4067 100644 --- a/lua/harpoon/ui.lua +++ b/lua/harpoon/ui.lua @@ -25,13 +25,21 @@ function HarpoonUI:new(settings) }, self) end +local function get_name(list) + if list ~= nil then + return list.name + end + + return "(list nil)" +end + function HarpoonUI:close_menu() if self.closing then return end self.closing = true - Logger:log("ui#close_menu name: ", self.active_list.name, "win and bufnr", { + Logger:log("ui#close_menu name: ", get_name(self.active_list), "win and bufnr", { win = self.win_id, bufnr = self.bufnr })