Prevent crash when removing service task if Core isn't alive

This commit is contained in:
Sylvain Berfini 2022-11-03 11:54:54 +01:00
parent b9c178cc29
commit f3ad232c1f

View file

@ -70,6 +70,7 @@ class CoreService : CoreService() {
}
override fun onTaskRemoved(rootIntent: Intent?) {
if (LinphoneApplication.contextExists()) {
if (coreContext.core.callsNb > 0) {
Log.w("[Service] Task removed but there is at least one active call, do not stop the Core!")
} else if (!corePreferences.keepServiceAlive) {
@ -82,6 +83,7 @@ class CoreService : CoreService() {
} else {
Log.i("[Service] Task removed but we were asked to keep the service alive, so doing nothing")
}
}
super.onTaskRemoved(rootIntent)
}