android: ForegroundService: Handle null intent.

This commit is contained in:
bunnei 2023-05-31 18:17:21 -07:00
parent 17ae85e724
commit 9ca8687b5f
1 changed files with 4 additions and 1 deletions

View File

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