Fix LINQ chain in `FirmwareManager.DoScanAndResolve`

fixes 963b925a1
This commit is contained in:
YoshiRulz 2024-08-18 16:02:59 +10:00
parent 963b925a1a
commit c319bf5fb8
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 2 additions and 6 deletions

View File

@ -165,12 +165,8 @@ namespace BizHawk.Client.Common
var found = FirmwareDatabase.FirmwareOptions
.Where(fo1 => fo1.ID == fr.ID && fo1.IsAcceptableOrIdeal && reader.Dict.ContainsKey(fo1.Hash))
.OrderByDescending(fo => fo.Status)
.Cast<FirmwareOption?>()
.FirstOrDefault();
if (found == null) continue; // didn't find any of them
var fo = found.Value;
// else found one, add it to the dict
_resolutionDictionary[fr] = new ResolutionInfo
.Take(1).ToArray(); // 0..1 elements (essentially, first or null)
if (found is [ FirmwareOption fo ]) _resolutionDictionary[fr] = new()
{
FilePath = reader.Dict[fo.Hash].FileInfo.FullName,
KnownFirmwareFile = FirmwareDatabase.FirmwareFilesByHash[fo.Hash],