1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-08-17 23:01:04 +02:00

fix(tray): crash when provided empty pixmap

Fixes #675
This commit is contained in:
Jake Stanger 2024-08-04 13:38:29 +01:00
parent 578293cd16
commit 2bc741d197
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61

View file

@ -90,6 +90,10 @@ fn get_image_from_pixmap(item: &TrayMenu, size: u32) -> Result<Image> {
.and_then(|pixmap| pixmap.first())
.ok_or_else(|| Report::msg("Failed to get pixmap from tray icon"))?;
if pixmap.width == 0 || pixmap.height == 0 {
return Err(Report::msg("empty pixmap"));
}
let mut pixels = pixmap.pixels.to_vec();
for i in (0..pixels.len()).step_by(4) {