From e59f17357d152544c04843cab64ae1aab71b40eb Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Fri, 18 Mar 2011 17:28:38 +0100 Subject: [PATCH] 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 --- lib/awful/widget/common.lua.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/awful/widget/common.lua.in b/lib/awful/widget/common.lua.in index 801ddc422..e85a95e71 100644 --- a/lib/awful/widget/common.lua.in +++ b/lib/awful/widget/common.lua.in @@ -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("<Invalid text>") + end bgb:set_bg(bg) bgb:set_bgimage(bg_image) ib:set_image(icon)