From f8a049759db966a35daba3fcff1fd4d4fd206381 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Thu, 4 Jul 2019 10:13:42 +0200 Subject: [PATCH] android: fix crash if notification is null I cannot see a path leading to it being null, but Crashlytics demonstrated it's possible (so far in a small subset of old devices). Be defensive then. --- .../meet/sdk/JitsiMeetOngoingConferenceService.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetOngoingConferenceService.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetOngoingConferenceService.java index 01abff5140..dd3e8c25b6 100644 --- a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetOngoingConferenceService.java +++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetOngoingConferenceService.java @@ -82,8 +82,13 @@ public class JitsiMeetOngoingConferenceService extends Service final String action = intent.getAction(); if (action.equals(Actions.START)) { Notification notification = OngoingNotification.buildOngoingConferenceNotification(); - startForeground(OngoingNotification.NOTIFICATION_ID, notification); - Log.i(TAG, "Service started"); + if (notification == null) { + stopSelf(); + Log.w(TAG, "Couldn't start service, notification is null"); + } else { + startForeground(OngoingNotification.NOTIFICATION_ID, notification); + Log.i(TAG, "Service started"); + } } else if (action.equals(Actions.HANGUP)) { Log.i(TAG, "Hangup requested"); // Abort all ongoing calls