fix crash when instance info fails to load (#4335)

Steps to reproduce: Cold start the app while being logged in and
offline.
This commit is contained in:
Konrad Pozniak 2024-03-26 18:25:34 +01:00 committed by GitHub
parent 00d7cc72b1
commit c7a1ddd589
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -21,7 +21,7 @@ import at.connyduck.calladapter.networkresult.getOrElse
import at.connyduck.calladapter.networkresult.getOrThrow
import at.connyduck.calladapter.networkresult.map
import at.connyduck.calladapter.networkresult.onSuccess
import at.connyduck.calladapter.networkresult.recover
import at.connyduck.calladapter.networkresult.recoverCatching
import com.keylesspalace.tusky.db.AccountManager
import com.keylesspalace.tusky.db.AppDatabase
import com.keylesspalace.tusky.db.EmojisEntity
@ -117,7 +117,7 @@ class InstanceInfoRepository @Inject constructor(
val instance = this.instanceName
return api.getInstance()
.map { it.toEntity() }
.recover { t ->
.recoverCatching { t ->
if (t.isHttpNotFound()) {
api.getInstanceV1().map { it.toEntity(instance) }.getOrThrow()
} else {