From c0ce81ca0e5dbb05f2b33564fb785828c004be22 Mon Sep 17 00:00:00 2001 From: fujie Date: Mon, 25 Sep 2023 16:09:09 +0800 Subject: [PATCH] fix(mobile): assetList is empty (#4213) * fix(mobile): assetList is empty * add comments --------- Co-authored-by: Alex --- mobile/lib/modules/backup/providers/backup.provider.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mobile/lib/modules/backup/providers/backup.provider.dart b/mobile/lib/modules/backup/providers/backup.provider.dart index 3e226d817d..95f0e3230a 100644 --- a/mobile/lib/modules/backup/providers/backup.provider.dart +++ b/mobile/lib/modules/backup/providers/backup.provider.dart @@ -218,6 +218,12 @@ class BackupNotifier extends StateNotifier { final assetCountInAlbum = await album.assetCountAsync; if (assetCountInAlbum > 0) { final assetList = await album.getAssetListPaged(page: 0, size: 1); + + // Even though we check assetCountInAlbum to make sure that there are assets in album + // The `getAssetListPaged` method still return empty list and cause not assets get rendered + if (assetList.isEmpty) { + continue; + } final thumbnailAsset = assetList.first; try { final thumbnailData = await thumbnailAsset