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:
Uli Schlachter 2011-03-18 17:28:38 +01:00
parent b6baca5857
commit e59f17357d
1 changed files with 5 additions and 1 deletions

View File

@ -9,6 +9,7 @@ local math = math
local type = type
local ipairs = ipairs
local pairs = pairs
local pcall = pcall
local setmetatable = setmetatable
local capi = { button = button }
local util = require("awful.util")
@ -86,7 +87,10 @@ function common.list_update(w, buttons, label, data, objects)
end
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>&lt;Invalid text&gt;</i>")
end
bgb:set_bg(bg)
bgb:set_bgimage(bg_image)
ib:set_image(icon)