Take care of edge case where in a shared folder does not have photos within
This commit is contained in:
parent
4dbf9c8078
commit
faed1c9fed
1 changed files with 10 additions and 3 deletions
|
@ -61,8 +61,12 @@ class _RemoteFolderGalleryWidgetState extends State<RemoteFolderGalleryWidget> {
|
|||
Future<List<Folder>> _getRemoteFolders() async {
|
||||
final folders = await FolderDB.instance.getFolders();
|
||||
for (final folder in folders) {
|
||||
folder.thumbnailPhoto =
|
||||
await PhotoDB.instance.getLatestPhotoInRemoteFolder(folder.id);
|
||||
try {
|
||||
folder.thumbnailPhoto =
|
||||
await PhotoDB.instance.getLatestPhotoInRemoteFolder(folder.id);
|
||||
} catch (e) {
|
||||
_logger.warning(e.toString());
|
||||
}
|
||||
}
|
||||
return folders;
|
||||
}
|
||||
|
@ -72,7 +76,10 @@ class _RemoteFolderGalleryWidgetState extends State<RemoteFolderGalleryWidget> {
|
|||
child: Column(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: ThumbnailWidget(folder.thumbnailPhoto),
|
||||
child: folder.thumbnailPhoto ==
|
||||
null // When the user has shared a folder without photos
|
||||
? Icon(Icons.error)
|
||||
: ThumbnailWidget(folder.thumbnailPhoto),
|
||||
height: 150,
|
||||
width: 150,
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue