Skip to content

Commit

Permalink
Prevent NPE in ImageLayer.getBounds()
Browse files Browse the repository at this point in the history
The recent [improvements to drop shadows](https://github.com/airbnb/lottie-android/pull/2548/files#diff-31e777f53a917d69dcf1b234ae6c77db843316c34911e200d0a9a160c058b621R110) added a dereference of a nullable result from the `getBitmap()` call.
  • Loading branch information
allenchen1154 committed Nov 15, 2024
1 parent 255352b commit 866a7b3
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ public class ImageLayer extends BaseLayer {
if (lottieDrawable.getMaintainOriginalImageBounds()) {
outBounds.set(0, 0, lottieImageAsset.getWidth() * scale, lottieImageAsset.getHeight() * scale);
} else {
outBounds.set(0, 0, getBitmap().getWidth() * scale, getBitmap().getHeight() * scale);
Bitmap bitmap = getBitmap();
if (bitmap != null) {
outBounds.set(0, 0, bitmap.getWidth() * scale, bitmap.getHeight() * scale);
}
}
boundsMatrix.mapRect(outBounds);
}
Expand Down

0 comments on commit 866a7b3

Please sign in to comment.