Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix: handle potential null collection in sync logic

Prateek Sunal24e81f9dc023
diff --git a/mobile/apps/photos/lib/services/smart_albums_service.dart b/mobile/apps/photos/lib/services/smart_albums_service.dart
index 32190530db..8c1c5c08cb 100644
--- a/mobile/apps/photos/lib/services/smart_albums_service.dart
+++ b/mobile/apps/photos/lib/services/smart_albums_service.dart
@@ -87,9 +87,9 @@ class SmartAlbumsService {
final collectionId = entry.key;
final config = entry.value;
final collection =
- CollectionsService.instance.getCollectionByID(collectionId)!;
+ CollectionsService.instance.getCollectionByID(collectionId);
- if (!collection.canAutoAdd(userId!)) {
+ if (!(collection?.canAutoAdd(userId!) ?? false)) {
_logger.warning(
"Deleting collection config ($collectionId) as user does not have permission",
);