mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-08-16 22:31: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:
commit
4f2f890c93
1 changed files with 4 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue