add image safeguards
This commit is contained in:
parent
f9702672f4
commit
d54c11fb74
|
@ -1122,7 +1122,9 @@ namespace Emby.Server.Implementations.Data
|
|||
return null;
|
||||
}
|
||||
|
||||
return string.Join("|", images.Select(ToValueString).ToArray());
|
||||
var imageStrings = images.Where(i => !string.IsNullOrWhiteSpace(i.Path)).Select(ToValueString).ToArray();
|
||||
|
||||
return string.Join("|", imageStrings);
|
||||
}
|
||||
|
||||
private void DeserializeImages(string value, BaseItem item)
|
||||
|
@ -1141,7 +1143,12 @@ namespace Emby.Server.Implementations.Data
|
|||
|
||||
foreach (var part in parts)
|
||||
{
|
||||
item.ImageInfos.Add(ItemImageInfoFromValueString(part));
|
||||
var image = ItemImageInfoFromValueString(part);
|
||||
|
||||
if (image != null)
|
||||
{
|
||||
item.ImageInfos.Add(image);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1149,7 +1156,14 @@ namespace Emby.Server.Implementations.Data
|
|||
{
|
||||
var delimeter = "*";
|
||||
|
||||
return (image.Path ?? string.Empty) +
|
||||
var path = image.Path;
|
||||
|
||||
if (path == null)
|
||||
{
|
||||
path = string.Empty;
|
||||
}
|
||||
|
||||
return path +
|
||||
delimeter +
|
||||
image.DateModified.Ticks.ToString(CultureInfo.InvariantCulture) +
|
||||
delimeter +
|
||||
|
@ -1162,6 +1176,11 @@ namespace Emby.Server.Implementations.Data
|
|||
{
|
||||
var parts = value.Split(new[] { '*' }, StringSplitOptions.None);
|
||||
|
||||
if (parts.Length != 4)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var image = new ItemImageInfo();
|
||||
|
||||
image.Path = parts[0];
|
||||
|
|
Loading…
Reference in New Issue
Block a user