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.
This commit is contained in:
Saúl Ibarra Corretgé 2019-07-04 10:13:42 +02:00 committed by Saúl Ibarra Corretgé
parent 4b4225e14f
commit f8a049759d
1 changed files with 7 additions and 2 deletions

View File

@ -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