[mob][photos] Fix issue with null person data (#4713)
## Description ## Tests
This commit is contained in:
@@ -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 =
|
||||
|
||||
@@ -357,6 +357,7 @@ class ClusterFeedbackService {
|
||||
personID: person.remoteID,
|
||||
clusterID: clusterID,
|
||||
);
|
||||
Bus.instance.fire(PeopleChangedEvent());
|
||||
}
|
||||
|
||||
Future<void> ignoreCluster(String clusterID) async {
|
||||
|
||||
@@ -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++);
|
||||
|
||||
@@ -377,7 +377,6 @@ class _SaveOrEditPersonState extends State<SaveOrEditPerson> {
|
||||
person: person.$1,
|
||||
clusterID: widget.clusterID!,
|
||||
);
|
||||
Bus.instance.fire(PeopleChangedEvent());
|
||||
|
||||
Navigator.pop(context, person);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user