Skip to content

Commit

Permalink
Merge pull request #35 from LottieFiles/fix/accept-nullish-value-in-o…
Browse files Browse the repository at this point in the history
…ut-tangents

fix: accept nullish ti/to
  • Loading branch information
karamalie authored Jul 21, 2023
2 parents 091c5ea + 6e8b023 commit a977c78
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/rude-parents-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lottiefiles/lottie-js': patch
---

Fix crash when parsing `null` value tangents
4 changes: 2 additions & 2 deletions src/timeline/key-frame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ export class KeyFrame {
this.frameOutTangent = hasFrameTangents ? [json.o.x, json.o.y] : undefined;

if (hasValueTangents) {
if ('x' in json.ti && 'y' in json.ti) {
if (json.ti && 'x' in json.ti && 'y' in json.ti) {
this.valueInTangent = [json.ti.x, json.ti.y];
} else {
this.valueInTangent = json.ti;
}

if ('x' in json.to && 'y' in json.to) {
if (json.to && 'x' in json.to && 'y' in json.to) {
this.valueOutTangent = [json.to.x, json.to.y];
} else {
this.valueOutTangent = json.to;
Expand Down

0 comments on commit a977c78

Please sign in to comment.