Fix crash when using .max function

This commit is contained in:
Moez Bhatti
2022-12-13 15:47:55 -05:00
parent 2bb7016b8e
commit c258644ae2
@@ -64,7 +64,7 @@ class BackupPresenter @Inject constructor(
.distinctUntilChanged()
.switchMap { backupRepo.getBackups() }
.doOnNext { backups -> newState { copy(backups = backups) } }
.map { backups -> backups.map { it.date }.max() ?: 0L }
.map { backups -> backups.maxOfOrNull { it.date } ?: 0L }
.map { lastBackup ->
when (lastBackup) {
0L -> context.getString(R.string.backup_never)