From 9ca8687b5f2be77eecc00855391f44623b841d15 Mon Sep 17 00:00:00 2001
From: bunnei <bunneidev@gmail.com>
Date: Wed, 31 May 2023 18:17:21 -0700
Subject: [PATCH] android: ForegroundService: Handle null intent.

---
 .../main/java/org/yuzu/yuzu_emu/utils/ForegroundService.kt   | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/ForegroundService.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/ForegroundService.kt
index 6261239660..dc9b7c7447 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/ForegroundService.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/ForegroundService.kt
@@ -52,7 +52,10 @@ class ForegroundService : Service() {
         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) {
             NotificationManagerCompat.from(this).cancel(EMULATION_RUNNING_NOTIFICATION)
             stopForeground(STOP_FOREGROUND_REMOVE)