kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
Fix: Handle null or empty release list in `getLatestRelease` (#1967)
rodzic
1f2254f98b
commit
091607da08
|
@ -52,8 +52,12 @@ class FirmwareReleaseLocalDataSource @Inject constructor(
|
|||
suspend fun getLatestRelease(releaseType: FirmwareReleaseType): FirmwareReleaseEntity? =
|
||||
withContext(Dispatchers.IO) {
|
||||
val releases = firmwareReleaseDao.getReleasesByType(releaseType)
|
||||
val latestRelease =
|
||||
releases?.maxBy { it.asDeviceVersion() }
|
||||
return@withContext latestRelease
|
||||
if (releases.isNullOrEmpty()) {
|
||||
return@withContext null
|
||||
} else {
|
||||
val latestRelease =
|
||||
releases.maxBy { it.asDeviceVersion() }
|
||||
return@withContext latestRelease
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue