Fixed reference aggregate collections nullable when empty

This commit is contained in:
JPVenson 2024-11-10 19:31:22 +00:00
parent 4959232b27
commit 4b0a5ea8e9

View File

@ -1368,7 +1368,7 @@ public sealed class BaseItemRepository(
dto.TotalBitrate = entity.TotalBitrate; dto.TotalBitrate = entity.TotalBitrate;
dto.ExternalId = entity.ExternalId; dto.ExternalId = entity.ExternalId;
dto.Size = entity.Size; dto.Size = entity.Size;
dto.Genres = entity.Genres?.Split('|'); dto.Genres = entity.Genres?.Split('|') ?? [];
dto.DateCreated = entity.DateCreated.GetValueOrDefault(); dto.DateCreated = entity.DateCreated.GetValueOrDefault();
dto.DateModified = entity.DateModified.GetValueOrDefault(); dto.DateModified = entity.DateModified.GetValueOrDefault();
dto.ChannelId = string.IsNullOrWhiteSpace(entity.ChannelId) ? Guid.Empty : Guid.Parse(entity.ChannelId); dto.ChannelId = string.IsNullOrWhiteSpace(entity.ChannelId) ? Guid.Empty : Guid.Parse(entity.ChannelId);
@ -1398,9 +1398,9 @@ public sealed class BaseItemRepository(
} }
dto.ExtraIds = string.IsNullOrWhiteSpace(entity.ExtraIds) ? null : entity.ExtraIds.Split('|').Select(e => Guid.Parse(e)).ToArray(); dto.ExtraIds = string.IsNullOrWhiteSpace(entity.ExtraIds) ? null : entity.ExtraIds.Split('|').Select(e => Guid.Parse(e)).ToArray();
dto.ProductionLocations = entity.ProductionLocations?.Split('|'); dto.ProductionLocations = entity.ProductionLocations?.Split('|') ?? [];
dto.Studios = entity.Studios?.Split('|'); dto.Studios = entity.Studios?.Split('|') ?? [];
dto.Tags = entity.Tags?.Split('|'); dto.Tags = entity.Tags?.Split('|') ?? [];
if (dto is IHasProgramAttributes hasProgramAttributes) if (dto is IHasProgramAttributes hasProgramAttributes)
{ {
@ -1440,12 +1440,12 @@ public sealed class BaseItemRepository(
if (dto is IHasArtist hasArtists) if (dto is IHasArtist hasArtists)
{ {
hasArtists.Artists = entity.Artists?.Split('|', StringSplitOptions.RemoveEmptyEntries); hasArtists.Artists = entity.Artists?.Split('|', StringSplitOptions.RemoveEmptyEntries) ?? [];
} }
if (dto is IHasAlbumArtist hasAlbumArtists) if (dto is IHasAlbumArtist hasAlbumArtists)
{ {
hasAlbumArtists.AlbumArtists = entity.AlbumArtists?.Split('|', StringSplitOptions.RemoveEmptyEntries); hasAlbumArtists.AlbumArtists = entity.AlbumArtists?.Split('|', StringSplitOptions.RemoveEmptyEntries) ?? [];
} }
if (dto is LiveTvProgram program) if (dto is LiveTvProgram program)