Fix panic when WM_NAME or NET_WM_NAME has invalid UTF-8
This commit is contained in:
parent
b6d281967c
commit
f261e3feec
1 changed files with 4 additions and 2 deletions
|
|
@ -519,7 +519,8 @@ impl XState {
|
|||
let cookie = self.get_property_cookie(window, x::ATOM_WM_NAME, x::ATOM_STRING, 256);
|
||||
let resolver = |reply: x::GetPropertyReply| {
|
||||
let data: &[u8] = reply.value();
|
||||
WmName::WmName(String::from_utf8(data.to_vec()).unwrap())
|
||||
let name = String::from_utf8_lossy(data).to_string();
|
||||
WmName::WmName(name)
|
||||
};
|
||||
|
||||
PropertyCookieWrapper {
|
||||
|
|
@ -537,7 +538,8 @@ impl XState {
|
|||
self.get_property_cookie(window, self.atoms.net_wm_name, self.atoms.utf8_string, 256);
|
||||
let resolver = |reply: x::GetPropertyReply| {
|
||||
let data: &[u8] = reply.value();
|
||||
WmName::NetWmName(String::from_utf8(data.to_vec()).unwrap())
|
||||
let name = String::from_utf8_lossy(data).to_string();
|
||||
WmName::NetWmName(name)
|
||||
};
|
||||
|
||||
PropertyCookieWrapper {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue