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.
This commit is contained in:
der richter 2020-02-22 14:21:06 +01:00
parent 327b092bfc
commit ee6ad403a7
1 changed files with 2 additions and 1 deletions

View File

@ -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
}