-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
I found that the following code is used inside the CentralManagerImpl class
lateinit var internalScope: CoroutineScope
init {
closeJob = scope.launch {
internalScope = this
//...
}
}
//...
protected fun peripheral(id: ID, factory: (ID) -> P): P {
// ...
state
.launchIn(internalScope)
}The problem with this code is that if internalScope has not been initialised, we will get an exception. For example this code:
val centralManager = CentralManagerImpl(scope)
centralManager.peripheral(ID) { } Can throw UninitializedPropertyAccessException if internalScope will not have time to reach execution
Metadata
Metadata
Assignees
Labels
No labels