Skip to content

Instantly share code, notes, and snippets.

@pepf
Created June 10, 2022 09:15
Show Gist options
  • Save pepf/742d4772545400919aece5649402b9e7 to your computer and use it in GitHub Desktop.
Save pepf/742d4772545400919aece5649402b9e7 to your computer and use it in GitHub Desktop.
diff --git a/node_modules/react-native-notifications/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java b/node_modules/react-native-notifications/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java
index 54a5fb8..d617dcf 100644
--- a/node_modules/react-native-notifications/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java
+++ b/node_modules/react-native-notifications/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java
@@ -8,6 +8,7 @@ import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
+import android.util.Log;
import com.facebook.react.bridge.ReactContext;
import com.wix.reactnativenotifications.core.AppLaunchHelper;
@@ -18,6 +19,7 @@ import com.wix.reactnativenotifications.core.InitialNotificationHolder;
import com.wix.reactnativenotifications.core.JsIOHelper;
import com.wix.reactnativenotifications.core.NotificationIntentAdapter;
+import static com.wix.reactnativenotifications.Defs.LOGTAG;
import static com.wix.reactnativenotifications.Defs.NOTIFICATION_OPENED_EVENT_NAME;
import static com.wix.reactnativenotifications.Defs.NOTIFICATION_RECEIVED_EVENT_NAME;
import static com.wix.reactnativenotifications.Defs.NOTIFICATION_RECEIVED_BACKGROUND_EVENT_NAME;
@@ -207,9 +209,12 @@ public class PushNotification implements IPushNotification {
private void notifyOpenedToJS() {
Bundle response = new Bundle();
- response.putBundle("notification", mNotificationProps.asBundle());
-
- mJsIOHelper.sendEventToJS(NOTIFICATION_OPENED_EVENT_NAME, response, mAppLifecycleFacade.getRunningReactContext());
+ try {
+ response.putBundle("notification", mNotificationProps.asBundle());
+ mJsIOHelper.sendEventToJS(NOTIFICATION_OPENED_EVENT_NAME, response, mAppLifecycleFacade.getRunningReactContext());
+ } catch (NullPointerException e) {
+ Log.e(LOGTAG, "notifyOpenedToJS: Null pointer exception");
+ }
}
protected void launchOrResumeApp() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment