mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-16 20:10:04 +03:00
avoiding null unwrapping by merging the contains check with eagerly throwing if the session component is missing
This commit is contained in:
parent
528c5a3671
commit
9c1d6e0484
1 changed files with 2 additions and 4 deletions
|
@ -52,10 +52,8 @@ internal class SessionManager @Inject constructor(private val matrixComponent: M
|
|||
}
|
||||
|
||||
fun stopSession(sessionId: String) {
|
||||
if (sessionComponents.containsKey(sessionId).not()) {
|
||||
throw RuntimeException("You don't have a session for id $sessionId")
|
||||
}
|
||||
sessionComponents[sessionId]!!.session().stopSync()
|
||||
val sessionComponent = sessionComponents[sessionId] ?: throw RuntimeException("You don't have a session for id $sessionId")
|
||||
sessionComponent.session().stopSync()
|
||||
}
|
||||
|
||||
fun getOrCreateSessionComponent(sessionParams: SessionParams): SessionComponent {
|
||||
|
|
Loading…
Add table
Reference in a new issue