mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-23 10:26:34 +11:00
Prevent null dereference on X11 with bad locale
This commit is contained in:
parent
f10a984ba3
commit
224872ce03
1 changed files with 8 additions and 1 deletions
|
@ -103,7 +103,14 @@ extern "C" fn preedit_draw_callback(
|
||||||
if xim_text.encoding_is_wchar > 0 {
|
if xim_text.encoding_is_wchar > 0 {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let new_text = unsafe { CStr::from_ptr(xim_text.string.multi_byte) };
|
|
||||||
|
let new_text = unsafe { xim_text.string.multi_byte };
|
||||||
|
|
||||||
|
if new_text.is_null() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let new_text = unsafe { CStr::from_ptr(new_text) };
|
||||||
|
|
||||||
String::from(new_text.to_str().expect("Invalid UTF-8 String from IME"))
|
String::from(new_text.to_str().expect("Invalid UTF-8 String from IME"))
|
||||||
.chars()
|
.chars()
|
||||||
|
|
Loading…
Add table
Reference in a new issue