From ac6093673dca859a9dc3ea0af184818c1a91b3c2 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 4 Aug 2008 16:21:12 +0200 Subject: [PATCH] awful: check that text is not nil Signed-off-by: Julien Danjou --- lib/awful.lua.in | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/awful.lua.in b/lib/awful.lua.in index e81af2a4..626b6364 100644 --- a/lib/awful.lua.in +++ b/lib/awful.lua.in @@ -940,11 +940,13 @@ end -- @param text Text to escape. -- @return Escape text. function escape(text) - text = text:gsub("&", "&") - text = text:gsub("<", "<") - text = text:gsub(">", ">") - text = text:gsub("'", "'") - text = text:gsub("\"", """) + if text then + text = text:gsub("&", "&") + text = text:gsub("<", "<") + text = text:gsub(">", ">") + text = text:gsub("'", "'") + text = text:gsub("\"", """) + end return text end @@ -952,11 +954,13 @@ end -- @param text Text to unescape. -- @return Unescaped text. function unescape(text) - text = text:gsub("&", "&") - text = text:gsub("<", "<") - text = text:gsub(">", ">") - text = text:gsub("'", "'") - text = text:gsub(""", "\"") + if text then + text = text:gsub("&", "&") + text = text:gsub("<", "<") + text = text:gsub(">", ">") + text = text:gsub("'", "'") + text = text:gsub(""", "\"") + end return text end