Skip to content

Commit

Permalink
Check if config contains a key before fetching. Default to 0 (#19808)
Browse files Browse the repository at this point in the history
Summary:
Potential Fix to #19793

modified the code and tried to recreate the bug and was unable to. The red screen never popped up and nothing else seemed to be affected in a negative way.

[ANDROID] [BUGFIX] [FrameBasedAnimationDriver.java] - Safely unwrapping ReadableMap by defaulting to 0 if key not present.
Pull Request resolved: #19808

Differential Revision: D8960388

Pulled By: hramos

fbshipit-source-id: 400cc0467e041dfcf2d6b1ec0b61d716c2de159f
  • Loading branch information
Bhavik Patel authored and facebook-github-bot committed Jul 24, 2018
1 parent 3d8b839 commit 1a6666a
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void resetConfig(ReadableMap config) {
for (int i = 0; i < numberOfFrames; i++) {
mFrames[i] = frames.getDouble(i);
}
mToValue = config.getDouble("toValue");
mToValue = config.hasKey("toValue") ? config.getDouble("toValue") : 0;
mIterations = config.hasKey("iterations") ? config.getInt("iterations") : 1;
mCurrentLoop = 1;
mHasFinished = mIterations == 0;
Expand Down

0 comments on commit 1a6666a

Please sign in to comment.