[mob][photos] Fix issue with null person data (#4713)

## Description

## Tests
This commit is contained in:
Laurens Priem
2025-01-14 06:37:51 +01:00
committed by GitHub
4 changed files with 5 additions and 4 deletions

View File

@@ -128,10 +128,12 @@ class PersonData {
// fromJson
factory PersonData.fromJson(Map<String, dynamic> json) {
final assigned = (json['assigned'] == null || json['assigned'].length == 0)
final assigned = (json['assigned'] == null || json['assigned'].length == 0 || json['assigned'] != Iterable)
? <ClusterInfo>[]
: List<ClusterInfo>.from(
json['assigned'].map((x) => ClusterInfo.fromJson(x)),
json['assigned']
.where((x) => x is Map<String, dynamic>)
.map((x) => ClusterInfo.fromJson(x as Map<String, dynamic>)),
);
final List<String> rejectedFaceIDs =

View File

@@ -357,6 +357,7 @@ class ClusterFeedbackService {
personID: person.remoteID,
clusterID: clusterID,
);
Bus.instance.fire(PeopleChangedEvent());
}
Future<void> ignoreCluster(String clusterID) async {

View File

@@ -255,7 +255,6 @@ class _PersonClustersState extends State<PersonReviewClusterSuggestion> {
person: widget.person,
clusterID: clusterID,
);
Bus.instance.fire(PeopleChangedEvent());
// Increment the suggestion index
if (mounted) {
setState(() => currentSuggestionIndex++);

View File

@@ -377,7 +377,6 @@ class _SaveOrEditPersonState extends State<SaveOrEditPerson> {
person: person.$1,
clusterID: widget.clusterID!,
);
Bus.instance.fire(PeopleChangedEvent());
Navigator.pop(context, person);
},