Skip to content

Commit 1a6666a

Browse files
Bhavik Patelfacebook-github-bot
Bhavik Patel
authored andcommitted
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
1 parent 3d8b839 commit 1a6666a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ReactAndroid/src/main/java/com/facebook/react/animated/FrameBasedAnimationDriver.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public void resetConfig(ReadableMap config) {
4141
for (int i = 0; i < numberOfFrames; i++) {
4242
mFrames[i] = frames.getDouble(i);
4343
}
44-
mToValue = config.getDouble("toValue");
44+
mToValue = config.hasKey("toValue") ? config.getDouble("toValue") : 0;
4545
mIterations = config.hasKey("iterations") ? config.getInt("iterations") : 1;
4646
mCurrentLoop = 1;
4747
mHasFinished = mIterations == 0;

0 commit comments

Comments
 (0)