Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob] Handle int value for face[blur] json

Neeraj Gupta9f1a3ad7d648
diff --git a/mobile/lib/models/ml/face/face.dart b/mobile/lib/models/ml/face/face.dart
index 4a794baff5..2aeeb7aff3 100644
--- a/mobile/lib/models/ml/face/face.dart
+++ b/mobile/lib/models/ml/face/face.dart
@@ -101,7 +101,7 @@ class Face {
json['score'] as double,
Detection.fromJson(json['detection'] as Map<String, dynamic>),
// high value means t
- (json['blur'] ?? kLapacianDefault) as double,
+ parseIntOrDoubleAsDouble(json['blur']) ?? kLapacianDefault,
);
}
@@ -116,6 +116,13 @@ class Face {
};
}
+double? parseIntOrDoubleAsDouble(dynamic value) {
+ if (value == null) return null;
+ if (value is int) return value * 1.0;
+ if (value is double) return value;
+ return null;
+}
+
List<double> parseAsDoubleList(List<dynamic> inputList) {
if (inputList.isEmpty) return const [];