From 1c1eff42988d97b9297867e67d790b5e7662775e Mon Sep 17 00:00:00 2001 From: hawkeye116477 Date: Thu, 4 Jan 2024 16:59:07 +0100 Subject: [PATCH] Fix potential crash --- src/EpicMetadataProvider.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/EpicMetadataProvider.cs b/src/EpicMetadataProvider.cs index 2748081..5cdc843 100644 --- a/src/EpicMetadataProvider.cs +++ b/src/EpicMetadataProvider.cs @@ -42,10 +42,14 @@ public override GameMetadata GetMetadata(Game game) { gameInfo.ReleaseDate = new ReleaseDate(legendaryReleaseDate.Year, legendaryReleaseDate.Month, legendaryReleaseDate.Day); } - var legendaryCover = legendaryMetadata.metadata.keyImages.FirstOrDefault(a => a.type == "DieselGameBoxTall").url; - if (!legendaryCover.IsNullOrEmpty()) + var legendaryImages = legendaryMetadata.metadata.keyImages; + if (legendaryImages.Length > 0) { - gameInfo.CoverImage = new MetadataFile(legendaryCover); + var legendaryCover = legendaryMetadata.metadata.keyImages?.FirstOrDefault(a => a.type == "DieselGameBoxTall").url; + if (!legendaryCover.IsNullOrEmpty()) + { + gameInfo.CoverImage = new MetadataFile(legendaryCover); + } } gameInfo.Features = new HashSet() { }; if (legendaryMetadata.metadata.customAttributes.CloudSaveFolder != null)