fix(status-area): prevent crash on invalid icon data

This commit is contained in:
Erik W 2025-06-14 14:12:21 +02:00 committed by Ashley Wulber
parent 5ac8605e7e
commit ac93c41c23

View file

@ -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);