Skip to content

armgit / ente

Public Imported from GitHub
0

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

Null safety check

laurenspriem6799acf9650a
diff --git a/mobile/lib/services/machine_learning/face_ml/person/person_service.dart b/mobile/lib/services/machine_learning/face_ml/person/person_service.dart
index 48355608b0..a5c31b6a7f 100644
--- a/mobile/lib/services/machine_learning/face_ml/person/person_service.dart
+++ b/mobile/lib/services/machine_learning/face_ml/person/person_service.dart
@@ -380,8 +380,15 @@ class PersonService {
for (var e in entities) {
final personData = PersonData.fromJson(json.decode(e.data));
if (personData.rejectedFaceIDs.isNotEmpty) {
+ final personClustersToFaceIDs = dbPeopleClusterInfo[e.id];
+ if (personClustersToFaceIDs == null) {
+ logger.warning(
+ "Person ${e.id} ${personData.name} has rejected faces but no clusters found in local DB",
+ );
+ continue;
+ }
final personFaceIDs =
- dbPeopleClusterInfo[e.id]!.values.expand((e) => e).toSet();
+ personClustersToFaceIDs.values.expand((e) => e).toSet();
final rejectedFaceIDsSet = personData.rejectedFaceIDs.toSet();
final assignedAndRejectedFaceIDs =
rejectedFaceIDsSet.intersection(personFaceIDs);