From 737f8504accc5d5240657045944f67a04acc0c30 Mon Sep 17 00:00:00 2001 From: Igor Ivanov Date: Tue, 20 Sep 2016 22:57:59 +0300 Subject: [PATCH] Prevent NullPointerException if application activity is singleTop and minimized/restored from launcher icon. (#108) In that case activity is reused and intent.getExtras() returns null. --- .../src/main/java/com/evollu/react/fcm/FIRMessagingModule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 a8567b36..a26c6ea7 100644 --- a/android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java +++ b/android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java @@ -207,7 +207,7 @@ public void onActivityResult(Activity activity, int requestCode, int resultCode, @Override public void onNewIntent(Intent intent){ Bundle bundle = intent.getExtras(); - Boolean isLocalNotification = bundle.getBoolean("localNotification", false); + Boolean isLocalNotification = bundle != null && bundle.getBoolean("localNotification", false); sendEvent(isLocalNotification ? "FCMLocalNotificationReceived" : "FCMNotificationReceived", parseIntent(intent)); } }