fix(status-area): prevent crash on invalid icon data
This commit is contained in:
parent
5ac8605e7e
commit
ac93c41c23
1 changed files with 6 additions and 0 deletions
|
|
@ -60,6 +60,12 @@ impl State {
|
|||
.into_iter()
|
||||
.max_by_key(|i| (i.width, i.height))
|
||||
.map(|mut i| {
|
||||
if i.width <= 0 || i.height <= 0 || i.bytes.is_empty() {
|
||||
// App sent invalid icon data during initialization - show placeholder until NewIcon signal
|
||||
eprintln!("Skipping invalid icon: {}x{} with {} bytes, app may still be initializing",
|
||||
i.width, i.height, i.bytes.len());
|
||||
return icon::from_name("dialog-question").symbolic(true).handle();
|
||||
}
|
||||
// Convert ARGB to RGBA
|
||||
for pixel in i.bytes.chunks_exact_mut(4) {
|
||||
pixel.rotate_left(1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue