NSCv3: catch stop service crash
This commit is contained in:
parent
90251178a9
commit
70db735476
1 changed files with 6 additions and 2 deletions
|
@ -194,7 +194,7 @@ class NSClientV3Plugin @Inject constructor(
|
||||||
disposable += rxBus
|
disposable += rxBus
|
||||||
.toObservable(EventAppExit::class.java)
|
.toObservable(EventAppExit::class.java)
|
||||||
.observeOn(aapsSchedulers.io)
|
.observeOn(aapsSchedulers.io)
|
||||||
.subscribe({ if (nsClientV3Service != null) context.unbindService(serviceConnection) }, fabricPrivacy::logException)
|
.subscribe({ stopService() }, fabricPrivacy::logException)
|
||||||
disposable += rxBus
|
disposable += rxBus
|
||||||
.toObservable(EventConnectivityOptionChanged::class.java)
|
.toObservable(EventConnectivityOptionChanged::class.java)
|
||||||
.observeOn(aapsSchedulers.io)
|
.observeOn(aapsSchedulers.io)
|
||||||
|
@ -359,7 +359,11 @@ class NSClientV3Plugin @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun stopService() {
|
private fun stopService() {
|
||||||
|
try {
|
||||||
if (nsClientV3Service != null) context.unbindService(serviceConnection)
|
if (nsClientV3Service != null) context.unbindService(serviceConnection)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
nsClientV3Service = null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun resend(reason: String) {
|
override fun resend(reason: String) {
|
||||||
|
|
Loading…
Reference in a new issue