From c1ac022e4e9d3effb2f0fb3404ad375d9fcbe4b6 Mon Sep 17 00:00:00 2001 From: Divine Niiquaye Ibok Date: Mon, 19 Aug 2024 14:17:07 +0000 Subject: [PATCH] fix(messaging, android): handle nullable broadcast intent (#7893) (#7960) Co-authored-by: Russell Wheatley --- .../messaging/ReactNativeFirebaseMessagingReceiver.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/messaging/android/src/main/java/io/invertase/firebase/messaging/ReactNativeFirebaseMessagingReceiver.java b/packages/messaging/android/src/main/java/io/invertase/firebase/messaging/ReactNativeFirebaseMessagingReceiver.java index f2dd1c7c64..cee80e8851 100644 --- a/packages/messaging/android/src/main/java/io/invertase/firebase/messaging/ReactNativeFirebaseMessagingReceiver.java +++ b/packages/messaging/android/src/main/java/io/invertase/firebase/messaging/ReactNativeFirebaseMessagingReceiver.java @@ -22,6 +22,10 @@ public void onReceive(Context context, Intent intent) { if (ReactNativeFirebaseApp.getApplicationContext() == null) { ReactNativeFirebaseApp.setApplicationContext(context.getApplicationContext()); } + if (intent.getExtras() == null) { + Log.e(TAG, "broadcast intent received with no extras"); + return; + } RemoteMessage remoteMessage = new RemoteMessage(intent.getExtras()); ReactNativeFirebaseEventEmitter emitter = ReactNativeFirebaseEventEmitter.getSharedInstance();