awful: check that text is not nil
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
9aa78f43e3
commit
ac6093673d
|
@ -940,11 +940,13 @@ end
|
|||
-- @param text Text to escape.
|
||||
-- @return Escape text.
|
||||
function escape(text)
|
||||
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)
|
||||
if text then
|
||||
text = text:gsub("&", "&")
|
||||
text = text:gsub("<", "<")
|
||||
text = text:gsub(">", ">")
|
||||
text = text:gsub("'", "'")
|
||||
text = text:gsub(""", "\"")
|
||||
end
|
||||
return text
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue