Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Verified Commit f5c37962 authored by Yash Garg's avatar Yash Garg 💬
Browse files

fix: check height width before converting to bitmap

parent 5c795373
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -305,13 +305,19 @@ public class BaseIconFactory implements AutoCloseable {
            scale = getNormalizer().getScale(icon, outIconBounds, dr.getIconMask(), outShape);
            if (!(icon instanceof AdaptiveIconDrawable) && !outShape[0]) {
                FixedScaleDrawable fsd = ((FixedScaleDrawable) dr.getForeground());
                fsd.setDrawable(icon);

                int color;
                if (icon.getIntrinsicHeight() > 0 && icon.getIntrinsicWidth() > 0) {
                    Bitmap bitmap = AdaptiveIconGenerator.toBitmap(icon);
                    fsd.setScale(AdaptiveIconGenerator.getScale(bitmap, scale));
                    color = ColorUtils.setAlphaComponent(new ColorExtractor().findDominantColorByHue(bitmap), 200);
                } else {
                    fsd.setScale(scale);
                    color = mWrapperBackgroundColor;
                }

                icon = dr;
                scale = getNormalizer().getScale(icon, outIconBounds, null, null);

                int color = ColorUtils.setAlphaComponent(new ColorExtractor().findDominantColorByHue(bitmap), 200);
                ((ColorDrawable) dr.getBackground()).setColor(color);
            }
        } else {