Skip to content

Commit 86f1c55

Browse files
tjleingThomas Leing
andauthored
If event collection is disabled, opening a notification will also cause a crash (#3169)
Co-authored-by: Thomas Leing <[email protected]>
1 parent 116c35d commit 86f1c55

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

aws-android-sdk-pinpoint/src/main/java/com/amazonaws/mobileconnectors/pinpoint/targeting/notification/NotificationClientBase.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -844,12 +844,15 @@ NotificationClient.PushResult handleNotificationOpen(
844844
if (this.pinpointContext.getSessionClient() != null) {
845845
this.pinpointContext.getSessionClient().stopSession();
846846
}
847-
this.pinpointContext.getAnalyticsClient().updateEventSourceGlobally(eventSourceAttributes);
848847

849-
String eventType = eventSourceType.getEventTypeOpenend();
850-
final AnalyticsEvent pushEvent = this.pinpointContext.getAnalyticsClient().createEvent(eventType);
851-
this.pinpointContext.getAnalyticsClient().recordEvent(pushEvent);
852-
this.pinpointContext.getAnalyticsClient().submitEvents();
848+
if (this.pinpointContext.getAnalyticsClient() != null) {
849+
this.pinpointContext.getAnalyticsClient().updateEventSourceGlobally(eventSourceAttributes);
850+
851+
String eventType = eventSourceType.getEventTypeOpenend();
852+
final AnalyticsEvent pushEvent = this.pinpointContext.getAnalyticsClient().createEvent(eventType);
853+
this.pinpointContext.getAnalyticsClient().recordEvent(pushEvent);
854+
this.pinpointContext.getAnalyticsClient().submitEvents();
855+
}
853856

854857
final String url = data.getString(EVENT_SOURCE_URL_PUSH_KEY);
855858
if (url != null) {

0 commit comments

Comments
 (0)