OneSignal / OneSignal-Xamarin-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Xamarin app with OneSignal. https://onesignal.com
Other
105 stars 50 forks source link

fixed NullReferenceException on Android NotificationToXam method #361

Closed andrepereiranmbrs closed 1 year ago

andrepereiranmbrs commented 1 year ago

Description

One Line Summary

Fix for a NullReferenceException on Android when opening a notification. The issue is in the NativeConversion.NotificationToXam(OneSignalAndroid.OSNotification notification) method.

Motivation

Fixes a crash when getting a notification after getting several crash reports on a production app.

NativeConversion.NotificationToXam (Com.OneSignal.Android.OSNotification notification)
System.NullReferenceException: Object reference not set to an instance of an object
NativeConversion.NotificationToXam (Com.OneSignal.Android.OSNotification notification)
NativeConversion.NotificationOpenedResultToXam (Com.OneSignal.Android.OSNotificationOpenedResult result)
OneSignalImplementation+OSNotificationOpenedHandler.NotificationOpened (Com.OneSignal.Android.OSNotificationOpenedResult notificationOpenedResult)
OneSignal+IOSNotificationOpenedHandlerInvoker.n_NotificationOpened_Lcom_onesignal_OSNotificationOpenedResult_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_p0)
JNINativeWrapper.Wrap_JniMarshal_PPL_V (_JniMarshal_PPL_V callback, System.IntPtr jnienv, System.IntPtr klazz, System.IntPtr p0)

Affected code checklist

Checklist

Overview

Testing

Final pass


This change is Reviewable