panel: Ensure client is valid after delayed call

This commit is contained in:
James Reed 2021-01-25 05:27:45 -07:00
parent fad8f6e108
commit 9465aa94af
No known key found for this signature in database
GPG Key ID: 0BE2BD33C5E8125E
1 changed files with 2 additions and 1 deletions

View File

@ -51,7 +51,8 @@ local function spawn(cmd, args)
end end
c:connect_signal("unfocus", function () c:connect_signal("unfocus", function ()
gtimer.delayed_call(function () gtimer.delayed_call(function ()
if c and not (client.focus and client.focus.floating) then local valid = pcall(function () return c.valid end) and c.valid
if valid and not (client.focus and client.focus.floating) then
panel.toggle_func(c, false) panel.toggle_func(c, false)
end end
end) end)