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

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

fix: check height width before converting to bitmap

parent 291cbef9
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -324,11 +324,19 @@ public class BaseIconFactory implements AutoCloseable {
            if (!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 {