1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-08-16 14:21:03 +02:00

Merge pull request #685 from JakeStanger/fix/tray-empty-icon

fix(tray): crash when provided empty pixmap
This commit is contained in:
Jake Stanger 2024-08-04 16:36:21 +01:00 committed by GitHub
commit 4f2f890c93
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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) {