From 232cbf28bf85ff74959e8f63a8450737e0103bc4 Mon Sep 17 00:00:00 2001 From: Dmitriy Kolesnikov Date: Thu, 9 Jun 2016 00:46:28 +0600 Subject: [PATCH] Check newIntent extras for null --- .../com/evollu/react/fcm/FIRMessagingModule.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 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 0b6cd6b..43a6b45 100644 --- a/android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java +++ b/android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java @@ -122,12 +122,15 @@ public class FIRMessagingModule extends ReactContextBaseJavaModule implements Li @Override public void onHostResume() { Intent newIntent = getCurrentActivity().getIntent(); - if(newIntent != mIntent && newIntent != null){ - WritableMap params = Arguments.fromBundle(newIntent.getExtras()); - WritableMap fcm = Arguments.createMap(); - fcm.putString("action", newIntent.getAction()); - params.putMap("fcm", fcm); - sendEvent("FCMNotificationReceived", params); + if(newIntent != mIntent && newIntent != null && newIntent.getExtras() != null){ + Bundle extras = newIntent.getExtras(); + if (extras != null) { + WritableMap params = Arguments.fromBundle(extras); + WritableMap fcm = Arguments.createMap(); + fcm.putString("action", newIntent.getAction()); + params.putMap("fcm", fcm); + sendEvent("FCMNotificationReceived", params); + } } mIntent = newIntent; } -- 2.26.2