Make fetchUpdate safe

This commit is contained in:
Wang Han
2025-10-02 04:03:44 -07:00
committed by John Wu
parent c07fdc87e3
commit ca2e40593f
2 changed files with 5 additions and 2 deletions
@@ -41,7 +41,9 @@ class NetworkService(
info
}
suspend fun fetchUpdate(version: Int) = findRelease { it.versionCode == version }.asInfo()
suspend fun fetchUpdate(version: Int) = safe {
findRelease { it.versionCode == version }.asInfo()
}
// Keep going through all release pages until we find a match
private suspend inline fun findRelease(predicate: (Release) -> Boolean): Release? {