From 3416e28f7325057ea3756febf92782d79ca7b88d Mon Sep 17 00:00:00 2001 From: Juha Heinanen Date: Sat, 3 Nov 2018 13:15:23 +0200 Subject: [PATCH] avoid crash at device (re)start --- app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt index a65644f0..5e6f1bce 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt @@ -426,9 +426,9 @@ class BaresipService: Service() { } catch (e: Exception) { Log.d(LOG_TAG, "Receiver nr has not been registered") } - nm.cancelAll() - if (wl.isHeld) wl.release() - if (fl.isHeld) fl.release() + if (this::nm.isInitialized) nm.cancelAll() + if (this::wl.isInitialized && wl.isHeld) wl.release() + if (this::fl.isInitialized && fl.isHeld) fl.release() if (IS_SERVICE_RUNNING) baresipStop(false) else if (RESTARTING)