Commit 737f8504 authored by Igor Ivanov's avatar Igor Ivanov Committed by Libin Lu

Prevent NullPointerException if application activity is singleTop and...

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.
parent e03ef47e
...@@ -207,7 +207,7 @@ public class FIRMessagingModule extends ReactContextBaseJavaModule implements Li ...@@ -207,7 +207,7 @@ public class FIRMessagingModule extends ReactContextBaseJavaModule implements Li
@Override @Override
public void onNewIntent(Intent intent){ public void onNewIntent(Intent intent){
Bundle bundle = intent.getExtras(); Bundle bundle = intent.getExtras();
Boolean isLocalNotification = bundle.getBoolean("localNotification", false); Boolean isLocalNotification = bundle != null && bundle.getBoolean("localNotification", false);
sendEvent(isLocalNotification ? "FCMLocalNotificationReceived" : "FCMNotificationReceived", parseIntent(intent)); sendEvent(isLocalNotification ? "FCMLocalNotificationReceived" : "FCMNotificationReceived", parseIntent(intent));
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment