Skip to content

Commit

Permalink
Fix IllegalArgumentException when createBitmap (#2351)
Browse files Browse the repository at this point in the history
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 #2350
  • Loading branch information
tonyfu511 authored Aug 1, 2023
1 parent 78dd109 commit 0014ef6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lottie/src/main/java/com/airbnb/lottie/LottieDrawable.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 0014ef6

Please sign in to comment.