From 0014ef6c3002cbea3d1bb36f13d886e3d2e3a9da Mon Sep 17 00:00:00 2001 From: tonyfu511 Date: Tue, 1 Aug 2023 14:03:34 -0700 Subject: [PATCH] Fix IllegalArgumentException when createBitmap (#2351) IllegalArgumentException is thrown when creating bitmap in ensureSoftwareRenderingBitmap() if the getIntrinsicWidth or getIntrinsicHeight returns -1. So, returns when renderWidth or renderHeight is negative to avoid the crash Fixes https://github.com/airbnb/lottie-android/issues/2350 --- lottie/src/main/java/com/airbnb/lottie/LottieDrawable.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lottie/src/main/java/com/airbnb/lottie/LottieDrawable.java b/lottie/src/main/java/com/airbnb/lottie/LottieDrawable.java index 68c45433c5..82233c0afd 100644 --- a/lottie/src/main/java/com/airbnb/lottie/LottieDrawable.java +++ b/lottie/src/main/java/com/airbnb/lottie/LottieDrawable.java @@ -1620,7 +1620,7 @@ private void renderAndDrawAsBitmap(Canvas originalCanvas, CompositionLayer compo int renderWidth = (int) Math.ceil(softwareRenderingTransformedBounds.width()); int renderHeight = (int) Math.ceil(softwareRenderingTransformedBounds.height()); - if (renderWidth == 0 || renderHeight == 0) { + if (renderWidth <= 0 || renderHeight <= 0) { return; }