Baseflow / Baseflow/LottieXamarin

Crash when json properties are reordered

Open
#303 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.2k
Forks
253
PR merge metrics
No merged PRs in 30d

Description

## 🐛 Bug Report
If you try to load a json file generated by a tool where the only change are the sorting of properties in the json file, the player will crash the app with the following error:

```
Java.Lang.NullPointerException
Message=Attempt to invoke virtual method 'com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation com.airbnb.lottie.model.animatable.AnimatableFloatValue.createAnimation()' on a null object reference

0xFFFFFFFFFFFFFFFF in System.Diagnostics.Debugger.Mono_UnhandledException_internal
0x1 in System.Diagnostics.Debugger.Mono_UnhandledException at /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/corlib/System.Diagnostics/Debugger.cs:125,4
0x38 in Android.Runtime.JNIEnv.PropagateUncaughtException at /Users/builder/azdo/_work/453/s/xamarin-android/src/Mono.Android/Android.Runtime/JNIEnv.cs:281,4
```

### Expected behavior
Should not crash.

### Reproduction steps
Simply try to load [this Lottie animation](https://lottiefiles.com/share/nrlb3fpn) or using the following json code:

JSON file content

``` json
{
"assets": [],
"ddd": 0,
"fr": 30,
"h": 36,
"ip": 0,
"layers": [
{
"ao": 0,
"bm": 0,
"ddd": 0,
"ind": 1,
"ip": 0,
"ks": {
"a": {
"a": 0,
"ix": 1,
"k": [
18,
18,
0
]
},
"o": {
"a": 0,
"ix": 11,
"k": 100
},
"p": {
"a": 0,
"ix": 2,
"k": [
18,
18,
0
]
},
"r": {
"a": 1,
"ix": 10,
"k": [
{
"i": {
"x": [
0.833
],
"y": [
0.833
]
},
"o": {
"x": [
0.167
],
"y": [
0.167
]
},
"s": [
0
],
"t": 0
},
{
"s": [
3240
],
"t": 180
}
]
},
"s": {
"a": 0,
"ix": 6,
"k": [
100,
100,
100
]
}
},
"nm": "blue_ellipse Silhouettes",
"op": 180,
"shapes": [
{
"bm": 0,
"cix": 2,
"hd": false,
"it": [
{
"hd": false,
"ind": 0,
"ix": 1,
"ks": {
"a": 0,
"ix": 2,
"k": {
"c": false,
"i": [
[
0,
0
],
[
-8.008,
0
],
[
0,
-8.008
]
],
"o": [
[
0,
-8.008
],
[
8.008,
0
],
[
0,
0
]
],
"v": [
[
-14.5,
7.25
],
[
0,
-7.25
],
[
14.5,
7.25
]
]
}
},
"mn": "ADBE Vector Shape - Group",
"nm": "Tracé 1",
"ty": "sh"
},
{
"bm": 0,
"c": {
"a": 0,
"ix": 3,
"k": [
0.161000001197,
0.416000007181,
0.795999983245,
1
]
},
"hd": false,
"lc": 2,
"lj": 1,
"ml": 10,
"mn": "ADBE Vector Graphic - Stroke",
"nm": "{ Color : var(Foreground) }",
"o": {
"a": 0,
"ix": 4,
"k": 100
},
"ty": "st",
"w": {
"a": 0,
"ix": 5,
"k": 3
}
},
{
"a": {
"a": 0,
"ix": 1,
"k": [
0,
0
]
},
"nm": "Transformer ",
"o": {
"a": 0,
"ix": 7,
"k": 100
},
"p": {
"a": 0,
"ix": 2,
"k": [
18,
10.75
]
},
"r": {
"a": 0,
"ix": 6,
"k": 0
},
"s": {
"a": 0,
"ix": 3,
"k": [
100,
100
]
},
"sa": {
"a": 0,
"ix": 5,
"k": 0
},
"sk": {
"a": 0,
"ix": 4,
"k": 0
},
"ty": "tr"
}
],
"ix": 1,
"mn": "ADBE Vector Group",
"nm": "Groupe 1",
"np": 2,
"ty": "gr"
},
{
"e": {
"a": 1,
"ix": 2,
"k": [
{
"i": {
"x": [
0.833
],
"y": [
0.833
]
},
"o": {
"x": [
0.167
],
"y": [
0.167
]
},
"s": [
100
],
"t": -1
},
{
"i": {
"x": [
0.833
],
"y": [
0.833
]
},
"o": {
"x": [
0.167
],
"y": [
0.167
]
},
"s": [
100
],
"t": 0
},
{
"s": [
100
],
"t": 144
}
]
},
"hd": false,
"ix": 2,
"m": 1,
"mn": "ADBE Vector Filter - Trim",
"nm": "Réduire les tracés 1",
"o": {
"a": 0,
"ix": 3,
"k": 0
},
"s": {
"a": 1,
"ix": 1,
"k": [
{
"i": {
"x": [
0.833
],
"y": [
0.833
]
},
"o": {
"x": [
0.167
],
"y": [
0.167
]
},
"s": [
0
],
"t": 0
},
{
"i": {
"x": [
0.833
],
"y": [
0.833
]
},
"o": {
"x": [
0.167
],
"y": [
0.167
]
},
"s": [
95
],
"t": 36
},
{
"i": {
"x": [
0.833
],
"y": [
0.833
]
},
"o": {
"x": [
0.167
],
"y": [
0.167
]
},
"s": [
0
],
"t": 72
},
{
"i": {
"x": [
0.833
],
"y": [
0.833
]
},
"o": {
"x": [
0.167
],
"y": [
0.167
]
},
"s": [
95
],
"t": 108
},
{
"i": {
"x": [
0.833
],
"y": [
0.833
]
},
"o": {
"x": [
0.167
],
"y": [
0.167
]
},
"s": [
0
],
"t": 144
},
{
"s": [
90
],
"t": 180
}
]
},
"ty": "tm"
}
],
"sr": 1,
"st": 0,
"ty": 4
},
{
"ao": 0,
"bm": 0,
"ddd": 0,
"ind": 2,
"ip": 0,
"ks": {
"a": {
"a": 0,
"ix": 1,
"k": [
18,
18,
0
]
},
"o": {
"a": 0,
"ix": 11,
"k": 100
},
"p": {
"a": 0,
"ix": 2,
"k": [
18,
18,
0
]
},
"r": {
"a": 0,
"ix": 10,
"k": 0
},
"s": {
"a": 0,
"ix": 6,
"k": [
100,
100,
100
]
}
},
"nm": "grey_ellipse Silhouettes",
"op": 180,
"shapes": [
{
"bm": 0,
"cix": 2,
"hd": false,
"it": [
{
"hd": false,
"ind": 0,
"ix": 1,
"ks": {
"a": 0,
"ix": 2,
"k": {
"c": true,
"i": [
[
0,
-8.008
],
[
8.008,
0
],
[
0,
8.008
],
[
-8.008,
0
]
],
"o": [
[
0,
8.008
],
[
-8.008,
0
],
[
0,
-8.008
],
[
8.008,
0
]
],
"v": [
[
14.5,
0
],
[
0,
14.5
],
[
-14.5,
0
],
[
0,
-14.5
]
]
}
},
"mn": "ADBE Vector Shape - Group",
"nm": "Tracé 1",
"ty": "sh"
},
{
"bm": 0,
"c": {
"a": 0,
"ix": 3,
"k": [
0.8,
0.8,
0.8,
1
]
},
"hd": false,
"lc": 2,
"lj": 1,
"ml": 10,
"mn": "ADBE Vector Graphic - Stroke",
"nm": "{ Color: var(Background) }",
"o": {
"a": 0,
"ix": 4,
"k": 100
},
"ty": "st",
"w": {
"a": 0,
"ix": 5,
"k": 3
}
},
{
"a": {
"a": 0,
"ix": 1,
"k": [
0,
0
]
},
"nm": "Transformer ",
"o": {
"a": 0,
"ix": 7,
"k": 100
},
"p": {
"a": 0,
"ix": 2,
"k": [
18,
18
]
},
"r": {
"a": 0,
"ix": 6,
"k": 0
},
"s": {
"a": 0,
"ix": 3,
"k": [
100,
100
]
},
"sa": {
"a": 0,
"ix": 5,
"k": 0
},
"sk": {
"a": 0,
"ix": 4,
"k": 0
},
"ty": "tr"
}
],
"ix": 1,
"mn": "ADBE Vector Group",
"nm": "Groupe 1",
"np": 2,
"ty": "gr"
}
],
"sr": 1,
"st": 0,
"ty": 4
}
],
"markers": [],
"meta": {
"a": "nventive",
"d": "progression-ring",
"g": "LottieFiles AE 0.1.20",
"k": "progression-ring",
"tc": ""
},
"nm": "pregression-ring",
"op": 140,
"v": "5.5.7",
"w": 36
}
```

### Configuration

**Version:** [`Com.Airbnb.Android.Lotti` v3.4.4](https://www.nuget.org/packages/Com.Airbnb.Android.Lottie/3.4.4) (latest version available on NuGet)

**Platform:**
- [ ] :iphone: iOS
- [X] :robot: Android (through Uno Platform using `Uno.UI.Lottie` package)
- [ ] :checkered_flag: WPF
- [ ] :earth_americas: UWP
- [ ] :apple: MacOS
- [ ] :tv: tvOS
- [ ] :monkey: Xamarin.Forms

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the crash with the linked Lottie animation and tracing the Android path named by AnimatableFloatValue.createAnimation(). Done means the animation loads without crashing, including when equivalent JSON properties are reordered.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, csharp
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.