fix: null check in updater

Signed-off-by: Infi <wingit@geist.ga>
This commit is contained in:
Infi 2023-06-14 19:09:23 +02:00
parent eeec84fd09
commit 933924328f
1 changed files with 4 additions and 2 deletions

View File

@ -1,6 +1,7 @@
package chat.revolt.screens.settings
import android.net.Uri
import android.util.Log
import androidx.browser.customtabs.CustomTabsIntent
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.layout.Arrangement
@ -83,7 +84,7 @@ data class UpdaterBody(
data class UpdaterResponse(
val outdated: Boolean,
@SerialName("newest_build")
val newestBuild: Int,
val newestBuild: Int?,
val token: String?,
)
@ -120,13 +121,14 @@ class ClosedBetaUpdaterScreenViewModel : ViewModel() {
delay(1000)
updateState = UpdateState.UpdateAvailable
newestBuild = outdated.newestBuild
newestBuild = outdated.newestBuild ?: -1
newestDownloadToken = outdated.token ?: ""
} else {
updateState = UpdateState.UpToDate
}
} catch (e: Exception) {
updateState = UpdateState.ErrorChecking
Log.e("Updater", "Error checking for updates", e)
return@launch
}
}