Skip to content

Crash at ImageLayer.getBounds when ImageLayer.getBitmap() is null in version 6.6.1 #2601

@bubble2025

Description

@bubble2025

Describe the bug
When attempting to dynamically change the bitmap in an image layer without putting the original reference image in the assets folder, the getBitmap() method in the ImageLayer returns null. However, a crash occurs at getBounds() (line 110) because the code does not check if the bitmap is null before attempting to access its width and height.

Sometimes, we want to dynamically change the image, and if no image is provided, we prefer to display an empty area at the image layer's position.

What version of Lottie did you test this on?
6.6.1
What version of Android did you test this on?
Android 14
Steps To Reproduce
Steps to reproduce the behavior:

  1. Do not place the default image file referenced by the image layer in the assets folder.
  2. Play the animation without updating the bitmap in the image layer.
  3. The application will crash.

Screenshots
截圖 2024-12-16 下午4 39 51

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions