mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-22 23:58:47 +01:00
Merge pull request #3425 from vector-im/feature/fga/fix_crash_signout
Fix crash on signout
This commit is contained in:
commit
270a195478
@ -20,6 +20,7 @@ import org.matrix.android.sdk.api.extensions.tryOrNull
|
||||
import org.matrix.android.sdk.api.session.Session
|
||||
import org.matrix.android.sdk.internal.SessionManager
|
||||
import org.matrix.android.sdk.internal.di.SessionId
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
@SessionScope
|
||||
@ -43,15 +44,16 @@ internal class SessionListeners @Inject constructor(
|
||||
|
||||
fun dispatch(block: (Session, Session.Listener) -> Unit) {
|
||||
synchronized(listeners) {
|
||||
val session = getSession()
|
||||
val session = getSession() ?: return Unit.also {
|
||||
Timber.w("You don't have any attached session")
|
||||
}
|
||||
listeners.forEach {
|
||||
tryOrNull { block(session, it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getSession(): Session {
|
||||
private fun getSession(): Session? {
|
||||
return sessionManager.getSessionComponent(sessionId)?.session()
|
||||
?: throw IllegalStateException("No session found with this id.")
|
||||
}
|
||||
}
|
||||
|
1
newsfragment/3424.bugfix
Normal file
1
newsfragment/3424.bugfix
Normal file
@ -0,0 +1 @@
|
||||
Fix app crashing when signing out
|
Loading…
Reference in New Issue
Block a user