Skip to content

Commit

Permalink
Parse as width/height as double (#2596)
Browse files Browse the repository at this point in the history
Fixes #2552
  • Loading branch information
gpeal authored Dec 15, 2024
1 parent 7b89be6 commit 0dd3818
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,13 @@ public static LottieComposition parse(JsonReader reader) throws IOException {
while (reader.hasNext()) {
switch (reader.selectName(NAMES)) {
case 0:
unscaledWidth = reader.nextInt();
// width/height should be an int. However, some exporters export doubles and we don't want to crash.
// Given that this is non-spec compliant, truncating to int is probably better than rounding to avoid
// the extra work in the vast majority of cases.
unscaledWidth = (int) reader.nextDouble();
break;
case 1:
unscaledHeight = reader.nextInt();
unscaledHeight = (int) reader.nextDouble();
break;
case 2:
startFrame = (float) reader.nextDouble();
Expand Down

0 comments on commit 0dd3818

Please sign in to comment.