Permalink
Browse files

Check if config contains a key before fetching. Default to 0 (#19808)

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-P authored and facebook-github-bot committed Jul 23, 2018
1 parent 3d8b839 commit 1a6666a116fd8b9e8637956de2b41a1c315dd470
@@ -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;

0 comments on commit 1a6666a

Please sign in to comment.