fix release builds throwing errors / accessing null objects

Reviewed By: zjj010104

Differential Revision: D2816705

fb-gh-sync-id: 0873fd26b3b34fb56abf5ed033198f1b1d84057f
This commit is contained in:
Aaron Chiu
2016-01-08 20:58:47 -08:00
committed by facebook-github-bot-8
parent bb73e98513
commit 73be933d09
2 changed files with 11 additions and 3 deletions

View File

@@ -9,6 +9,7 @@
package com.facebook.react.devsupport;
import com.facebook.react.bridge.DefaultNativeModuleCallExceptionHandler;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.modules.debug.DeveloperSettings;
@@ -19,6 +20,12 @@ import com.facebook.react.modules.debug.DeveloperSettings;
*/
public class DisabledDevSupportManager implements DevSupportManager {
private final DefaultNativeModuleCallExceptionHandler mDefaultNativeModuleCallExceptionHandler;
public DisabledDevSupportManager() {
mDefaultNativeModuleCallExceptionHandler = new DefaultNativeModuleCallExceptionHandler();
}
@Override
public void showNewJavaError(String message, Throwable e) {
@@ -111,6 +118,6 @@ public class DisabledDevSupportManager implements DevSupportManager {
@Override
public void handleException(Exception e) {
mDefaultNativeModuleCallExceptionHandler.handleException(e);
}
}

View File

@@ -31,7 +31,7 @@ import com.facebook.react.common.ReactConstants;
public class AnimationsDebugModule extends ReactContextBaseJavaModule {
private @Nullable FpsDebugFrameCallback mFrameCallback;
private final DeveloperSettings mCatalystSettings;
private @Nullable final DeveloperSettings mCatalystSettings;
public AnimationsDebugModule(
ReactApplicationContext reactContext,
@@ -47,7 +47,8 @@ public class AnimationsDebugModule extends ReactContextBaseJavaModule {
@ReactMethod
public void startRecordingFps() {
if (!mCatalystSettings.isAnimationFpsDebugEnabled()) {
if (mCatalystSettings == null ||
!mCatalystSettings.isAnimationFpsDebugEnabled()) {
return;
}