Răsfoiți Sursa

android: ForegroundService: Handle null intent.

bunnei 3 ani în urmă
părinte
comite
9ca8687b5f

+ 4 - 1
src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/ForegroundService.kt

@@ -52,7 +52,10 @@ class ForegroundService : Service() {
         showRunningNotification()
         showRunningNotification()
     }
     }
 
 
-    override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
+    override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
+        if (intent == null) {
+            return START_NOT_STICKY;
+        }
         if (intent.action == ACTION_STOP) {
         if (intent.action == ACTION_STOP) {
             NotificationManagerCompat.from(this).cancel(EMULATION_RUNNING_NOTIFICATION)
             NotificationManagerCompat.from(this).cancel(EMULATION_RUNNING_NOTIFICATION)
             stopForeground(STOP_FOREGROUND_REMOVE)
             stopForeground(STOP_FOREGROUND_REMOVE)