tasklist/taglist: Handle invalid text better
When some client sets an invalid window title, a lua error was generated while updating the tasklist. This caused all later tasklist entries to be skipped / missing and the last entry to be empty. Fix this by catching lua errors with pcall. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
b6baca5857
commit
e59f17357d
|
@ -9,6 +9,7 @@ local math = math
|
||||||
local type = type
|
local type = type
|
||||||
local ipairs = ipairs
|
local ipairs = ipairs
|
||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
|
local pcall = pcall
|
||||||
local setmetatable = setmetatable
|
local setmetatable = setmetatable
|
||||||
local capi = { button = button }
|
local capi = { button = button }
|
||||||
local util = require("awful.util")
|
local util = require("awful.util")
|
||||||
|
@ -86,7 +87,10 @@ function common.list_update(w, buttons, label, data, objects)
|
||||||
end
|
end
|
||||||
|
|
||||||
local text, bg, bg_image, icon = label(o)
|
local text, bg, bg_image, icon = label(o)
|
||||||
tb:set_markup(text)
|
-- The text might be invalid, so use pcall
|
||||||
|
if not pcall(tb.set_markup, tb, text) then
|
||||||
|
tb:set_markup("<i><Invalid text></i>")
|
||||||
|
end
|
||||||
bgb:set_bg(bg)
|
bgb:set_bg(bg)
|
||||||
bgb:set_bgimage(bg_image)
|
bgb:set_bgimage(bg_image)
|
||||||
ib:set_image(icon)
|
ib:set_image(icon)
|
||||||
|
|
Loading…
Reference in New Issue