From 504a674b5814c7b470139218f58e4f5e4ea38dac Mon Sep 17 00:00:00 2001 From: Libin Lu Date: Wed, 27 Sep 2017 09:39:42 -0400 Subject: [PATCH] fix null issue --- .../java/com/evollu/react/fcm/FIRMessagingModule.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java b/android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java index efca0d5..b5aa4ff 100644 --- a/android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java +++ b/android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java @@ -58,12 +58,16 @@ public class FIRMessagingModule extends ReactContextBaseJavaModule implements Li @ReactMethod public void getInitialNotification(Promise promise){ Activity activity = getCurrentActivity(); + if(activity == null){ + promise.resolve(null); + return; + } Intent intent = activity.getIntent(); - if(activity == null || (intent.getAction() != null && intent.getAction().equals("android.intent.action.MAIN"))){ + if(intent.getAction() != null && intent.getAction().equals("android.intent.action.MAIN")){ promise.resolve(null); return; } - promise.resolve(parseIntent(activity.getIntent())); + promise.resolve(parseIntent(intent)); } @ReactMethod -- 2.26.2