fix: handle null ratingKey in folder browsing

This commit is contained in:
edde746
2026-03-11 22:08:11 +01:00
parent 7014df7a0e
commit 1f7fb2201c
2 changed files with 5 additions and 1 deletions
+4
View File
@@ -9,6 +9,9 @@ import '../utils/global_key_utils.dart';
part 'plex_metadata.g.dart';
Object? _readRatingKey(Map json, String key) =>
json['ratingKey'] ?? json['key'] ?? '';
int? _flexibleInt(Object? v) => switch (v) {
num n => n.toInt(),
String s => int.tryParse(s),
@@ -57,6 +60,7 @@ enum PlexMediaType {
@JsonSerializable()
class PlexMetadata with MultiServerFields {
@JsonKey(readValue: _readRatingKey)
final String ratingKey;
final String key;
final String? guid;
+1 -1
View File
@@ -7,7 +7,7 @@ part of 'plex_metadata.dart';
// **************************************************************************
PlexMetadata _$PlexMetadataFromJson(Map<String, dynamic> json) => PlexMetadata(
ratingKey: json['ratingKey'] as String,
ratingKey: _readRatingKey(json, 'ratingKey') as String,
key: json['key'] as String,
guid: json['guid'] as String?,
studio: json['studio'] as String?,