From 8d59512cccefc65b83c508fbf9dcb3073dc2c5c9 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Fri, 30 Jul 2010 14:15:42 +0200 Subject: [PATCH] Naughty: Handle invalid UTF-8 more sanely Previously, if setting the textbox's text failed this caused more problems later on. This commit makes sure that an invalid text never breaks pango. Signed-off-by: Uli Schlachter --- lib/naughty.lua.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/naughty.lua.in b/lib/naughty.lua.in index 7ed21092..50d20408 100644 --- a/lib/naughty.lua.in +++ b/lib/naughty.lua.in @@ -365,7 +365,9 @@ function notify(args) -- (Setting a textbox' .text to an invalid pattern throws a lua error) if not pcall(setText, "", "\n") then -- That failed, escape everything which might cause an error from pango - setText("[<>&]", { ['<'] = "<", ['>'] = ">", ['&'] = "&" }) + if not pcall(setText, "[<>&]", { ['<'] = "<", ['>'] = ">", ['&'] = "&" }) then + textbox.text = "<Invalid markup, cannot display message>" + end end -- create iconbox