mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-03-16 04:53:53 -04:00
Fix: Handle null or empty release list in getLatestRelease (#1967)
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user