diff options
author | 2018-02-16 13:39:45 -0500 | |
---|---|---|
committer | 2018-02-16 13:39:45 -0500 | |
commit | f4d6e2434329917799b89a91ff1063ed75127466 (patch) | |
tree | 50ba8b23facb78c6aa0350820e3b9439c074d5da /core | |
parent | 64dd43f93aeb50768ab9b82bf40a384f1a44ab16 (diff) | |
download | textadept-f4d6e2434329917799b89a91ff1063ed75127466.tar.gz textadept-f4d6e2434329917799b89a91ff1063ed75127466.zip |
Fixed crash when attempting to show badly-encoded filename in titlebar.
Diffstat (limited to 'core')
-rw-r--r-- | core/ui.lua | 4 |
1 files changed, 3 insertions, 1 deletions
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) |