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 <psychon@znc.in>
This commit is contained in:
parent
457913a0e8
commit
8d59512ccc
|
@ -365,7 +365,9 @@ function notify(args)
|
|||
-- (Setting a textbox' .text to an invalid pattern throws a lua error)
|
||||
if not pcall(setText, "<br.->", "\n") then
|
||||
-- That failed, escape everything which might cause an error from pango
|
||||
setText("[<>&]", { ['<'] = "<", ['>'] = ">", ['&'] = "&" })
|
||||
if not pcall(setText, "[<>&]", { ['<'] = "<", ['>'] = ">", ['&'] = "&" }) then
|
||||
textbox.text = "<i><Invalid markup, cannot display message></i>"
|
||||
end
|
||||
end
|
||||
|
||||
-- create iconbox
|
||||
|
|
Loading…
Reference in New Issue