diff options
author | der richter <der.richter@gmx.de> | 2020-02-22 14:21:06 +0100 |
---|---|---|
committer | der richter <der.richter@gmx.de> | 2020-02-22 14:21:06 +0100 |
commit | ee6ad403a7c73e587c6de7ced71861df29413926 (patch) | |
tree | 7765fec02b2bd31d65cb28b4e5323d3ccae9c39b /video/out | |
parent | 327b092bfc1c0efacfe669d9a0c220ca921257fc (diff) | |
download | mpv-ee6ad403a7c73e587c6de7ced71861df29413926.tar.bz2 mpv-ee6ad403a7c73e587c6de7ced71861df29413926.tar.xz |
cocoa-cb: fix crash with some japanese characters
the actual character that made mpv crash is IDEOGRAPHIC COMMA
(U+3001, UTF-8: E3 80 81, 、) and that only in some specific
circumstances that could be reliably reproduced on my end.
using an NSString instead of the Swift String actually fixes that issues
even though they should technically do the exact same thing. i tested
all the other String initialisers, but they all had had the same issue.
this is kinda only a workaround till i can find a different way of
handling it.
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/cocoa_cb_common.swift | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/video/out/cocoa_cb_common.swift b/video/out/cocoa_cb_common.swift index 493932ff7f..7fc4d0c0ea 100644 --- a/video/out/cocoa_cb_common.swift +++ b/video/out/cocoa_cb_common.swift @@ -539,7 +539,8 @@ class CocoaCB: NSObject { case VOCTRL_UPDATE_WINDOW_TITLE: if let titleData = data?.assumingMemoryBound(to: Int8.self) { DispatchQueue.main.async { - ccb.title = String(cString: titleData) + let title = NSString(utf8String: titleData) as String? + ccb.title = title ?? "Unknown Title" } return VO_TRUE } |