Skip to content

Commit

Permalink
fix(messaging, android): handle nullable broadcast intent (#7893)
Browse files Browse the repository at this point in the history
Add a check to handle scenarios where the broadcast intent comes with no extras, preventing potential crashes and logging an error for better debugging.
  • Loading branch information
divineniiquaye committed Aug 7, 2024
1 parent 9387ff9 commit 5bb992e
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 5bb992e

Please sign in to comment.