Returning empty viewState instead of null to avoid crash

This commit is contained in:
Maxime Naturel 2022-02-21 14:55:08 +01:00
parent cb9df953fb
commit f050fc1e4a

View File

@ -56,7 +56,7 @@ class SoftLogoutViewModel @AssistedInject constructor(
companion object : MavericksViewModelFactory<SoftLogoutViewModel, SoftLogoutViewState> by hiltMavericksViewModelFactory() {
override fun initialState(viewModelContext: ViewModelContext): SoftLogoutViewState? {
override fun initialState(viewModelContext: ViewModelContext): SoftLogoutViewState {
val sessionHolder = EntryPoints.get(viewModelContext.app(), SingletonEntryPoint::class.java)
.activeSessionHolder()
@ -72,7 +72,13 @@ class SoftLogoutViewModel @AssistedInject constructor(
hasUnsavedKeys = session.hasUnsavedKeys()
)
} else {
null
SoftLogoutViewState(
homeServerUrl = "",
userId = "",
deviceId = "",
userDisplayName = "",
hasUnsavedKeys = false
)
}
}
}