Merge pull request #816 from zed-industries/render-icon-panic

Don't panic when allocating tiny_skia pixmap
This commit is contained in:
Max Brunsfeld 2022-04-13 15:31:47 -07:00 committed by GitHub
commit efa6af427d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -143,7 +143,7 @@ impl SpriteCache {
}) {
Entry::Occupied(entry) => Some(entry.get().clone()),
Entry::Vacant(entry) => {
let mut pixmap = tiny_skia::Pixmap::new(size.x() as u32, size.y() as u32).unwrap();
let mut pixmap = tiny_skia::Pixmap::new(size.x() as u32, size.y() as u32)?;
resvg::render(&svg, usvg::FitTo::Width(size.x() as u32), pixmap.as_mut());
let mask = pixmap
.pixels()