From 7520ffd6c3ccc80b22a5e5bad678dc95c6d77158 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 6 May 2024 23:00:52 -0500 Subject: [PATCH] fix(mobile): allow select empty album as backup album (#9290) --- mobile/lib/providers/backup/backup.provider.dart | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/mobile/lib/providers/backup/backup.provider.dart b/mobile/lib/providers/backup/backup.provider.dart index 6568943722..ab869c2328 100644 --- a/mobile/lib/providers/backup/backup.provider.dart +++ b/mobile/lib/providers/backup/backup.provider.dart @@ -294,17 +294,29 @@ class BackupNotifier extends StateNotifier { final Set assetsFromExcludedAlbums = {}; for (final album in state.selectedBackupAlbums) { + final assetCount = await album.albumEntity.assetCountAsync; + + if (assetCount == 0) { + continue; + } + final assets = await album.albumEntity.getAssetListRange( start: 0, - end: await album.albumEntity.assetCountAsync, + end: assetCount, ); assetsFromSelectedAlbums.addAll(assets); } for (final album in state.excludedBackupAlbums) { + final assetCount = await album.albumEntity.assetCountAsync; + + if (assetCount == 0) { + continue; + } + final assets = await album.albumEntity.getAssetListRange( start: 0, - end: await album.albumEntity.assetCountAsync, + end: assetCount, ); assetsFromExcludedAlbums.addAll(assets); }