Skip to content

Commit

Permalink
Merge pull request #685 from JakeStanger/fix/tray-empty-icon
Browse files Browse the repository at this point in the history
fix(tray): crash when provided empty pixmap
  • Loading branch information
JakeStanger authored Aug 4, 2024
2 parents eaf13c5 + 2bc741d commit 4f2f890
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/modules/tray/icon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 4f2f890

Please sign in to comment.