mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
Fix: Handle null or empty release list in getLatestRelease (#1967)
This commit is contained in:
parent
1f2254f98b
commit
091607da08
1 changed files with 7 additions and 3 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue