From f4d6e2434329917799b89a91ff1063ed75127466 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Fri, 16 Feb 2018 13:39:45 -0500 Subject: Fixed crash when attempting to show badly-encoded filename in titlebar. --- core/ui.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/ui.lua b/core/ui.lua index 6b3f51b5..708a6454 100644 --- a/core/ui.lua +++ b/core/ui.lua @@ -272,7 +272,9 @@ events_connect(events.TAB_CLICKED, -- Sets the title of the Textadept window to the buffer's filename. local function set_title() local filename = buffer.filename or buffer._type or _L['Untitled'] - if buffer.filename then filename = filename:iconv('UTF-8', _CHARSET) end + if buffer.filename then + filename = select(2, pcall(string.iconv, filename, 'UTF-8', _CHARSET)) + end local basename = buffer.filename and filename:match('[^/\\]+$') or filename ui.title = string.format('%s %s Textadept (%s)', basename, buffer.modify and '*' or '-', filename) -- cgit v1.2.3