From d309a67416dea4d6080709e3182b52c88c06dc7a Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Mon, 31 May 2021 14:48:59 +0200 Subject: [PATCH] Capture exception when restart service --- .../keepass/services/DatabaseTaskNotificationService.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/services/DatabaseTaskNotificationService.kt b/app/src/main/java/com/kunzisoft/keepass/services/DatabaseTaskNotificationService.kt index b24a1015d..cf1bfb179 100644 --- a/app/src/main/java/com/kunzisoft/keepass/services/DatabaseTaskNotificationService.kt +++ b/app/src/main/java/com/kunzisoft/keepass/services/DatabaseTaskNotificationService.kt @@ -280,8 +280,10 @@ open class DatabaseTaskNotificationService : LockNotificationService(), Progress stopSelf() } else { // Restart the service to open lock notification - startService(Intent(applicationContext, - DatabaseTaskNotificationService::class.java)) + try { + startService(Intent(applicationContext, + DatabaseTaskNotificationService::class.java)) + } catch (e: IllegalStateException) {} } } }