Fix potential null reference
This commit is contained in:
parent
a4a261e940
commit
13f347a813
|
@ -582,16 +582,22 @@ namespace Emby.Server.Implementations.Dto
|
||||||
{
|
{
|
||||||
baseItemPerson.PrimaryImageTag = GetTagAndFillBlurhash(dto, entity, ImageType.Primary);
|
baseItemPerson.PrimaryImageTag = GetTagAndFillBlurhash(dto, entity, ImageType.Primary);
|
||||||
baseItemPerson.Id = entity.Id.ToString("N", CultureInfo.InvariantCulture);
|
baseItemPerson.Id = entity.Id.ToString("N", CultureInfo.InvariantCulture);
|
||||||
// Only add BlurHash for the person's image.
|
if (dto.ImageBlurHashes != null)
|
||||||
baseItemPerson.ImageBlurHashes = new Dictionary<ImageType, Dictionary<string, string>>();
|
|
||||||
foreach (var (imageType, blurHash) in dto.ImageBlurHashes)
|
|
||||||
{
|
{
|
||||||
baseItemPerson.ImageBlurHashes[imageType] = new Dictionary<string, string>();
|
// Only add BlurHash for the person's image.
|
||||||
foreach (var (imageId, blurHashValue) in blurHash)
|
baseItemPerson.ImageBlurHashes = new Dictionary<ImageType, Dictionary<string, string>>();
|
||||||
|
foreach (var (imageType, blurHash) in dto.ImageBlurHashes)
|
||||||
{
|
{
|
||||||
if (string.Equals(baseItemPerson.PrimaryImageTag, imageId, StringComparison.OrdinalIgnoreCase))
|
if (blurHash != null)
|
||||||
{
|
{
|
||||||
baseItemPerson.ImageBlurHashes[imageType][imageId] = blurHashValue;
|
baseItemPerson.ImageBlurHashes[imageType] = new Dictionary<string, string>();
|
||||||
|
foreach (var (imageId, blurHashValue) in blurHash)
|
||||||
|
{
|
||||||
|
if (string.Equals(baseItemPerson.PrimaryImageTag, imageId, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
baseItemPerson.ImageBlurHashes[imageType][imageId] = blurHashValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user