LocalSync: Handle empty album

This commit is contained in:
Neeraj Gupta 2022-10-07 03:26:59 +05:30
parent 162d1ab658
commit ddf8b6438e
No known key found for this signature in database
GPG key ID: 3C5A1684DC1729E1

View file

@ -70,12 +70,12 @@ Future<List<Tuple2<AssetPathEntity, String>>>
const OrderOption(type: OrderOptionType.createDate, asc: false), const OrderOption(type: OrderOptionType.createDate, asc: false),
); );
for (AssetPathEntity pathEntity in pathEntities) { for (AssetPathEntity pathEntity in pathEntities) {
//todo: test and handle empty album case
final latestEntity = await pathEntity.getAssetListPaged( final latestEntity = await pathEntity.getAssetListPaged(
page: 0, page: 0,
size: 1, size: 1,
); );
final String localCoverID = latestEntity.first.id; final String localCoverID =
latestEntity.isEmpty ? '' : latestEntity.first.id;
result.add(Tuple2(pathEntity, localCoverID)); result.add(Tuple2(pathEntity, localCoverID));
} }
return result; return result;