Skip to content

Rendering a JSON file that has been rearranged or reordered causes crashes. #2717

@ralpheufracio

Description

@ralpheufracio

Describe the bug
A NullPointerException is thrown when attempting to load a valid Lottie JSON file where the key-value pairs inside have been rearranged/reordered (but no data has been stripped or optimized away). This suggests that the parser may be relying on a strict key order when instantiating gradient properties.

What version of Lottie did you test this on?
6.7.1

What version of Android did you test this on?
API Level 36 (Android 16)

Steps To Reproduce

  1. Take a working Lottie animation .
  2. Rearrange the key-value pairs (e.g., passing it through a JSON formatter or linter that alphabetically reorders keys, without minifying or deleting anything).
  3. Load the rearranged JSON using LottieAnimationView or LottieCompositionFactory.
  4. Observe the crash.

Thrown Error

java.lang.NullPointerException: Attempt to invoke virtual method 'com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation com.airbnb.lottie.model.animatable.AnimatableGradientColorValue.createAnimation()' on a null object reference

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions