浏览代码

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.
master
Saúl Ibarra Corretgé 6 年前
父节点
当前提交
f8a049759d
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. 7
    2
      android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetOngoingConferenceService.java

+ 7
- 2
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetOngoingConferenceService.java 查看文件

@@ -82,8 +82,13 @@ public class JitsiMeetOngoingConferenceService extends Service
82 82
         final String action = intent.getAction();
83 83
         if (action.equals(Actions.START)) {
84 84
             Notification notification = OngoingNotification.buildOngoingConferenceNotification();
85
-            startForeground(OngoingNotification.NOTIFICATION_ID, notification);
86
-            Log.i(TAG, "Service started");
85
+            if (notification == null) {
86
+                stopSelf();
87
+                Log.w(TAG, "Couldn't start service, notification is null");
88
+            } else {
89
+                startForeground(OngoingNotification.NOTIFICATION_ID, notification);
90
+                Log.i(TAG, "Service started");
91
+            }
87 92
         } else if (action.equals(Actions.HANGUP)) {
88 93
             Log.i(TAG, "Hangup requested");
89 94
             // Abort all ongoing calls

正在加载...
取消
保存