don't depend on exceptions for flow control

This commit is contained in:
zeromus 2021-03-25 20:47:29 -04:00
parent c6dcb71d92
commit 5567a42bb1
1 changed files with 6 additions and 11 deletions

View File

@ -125,17 +125,12 @@ namespace BizHawk.Client.Common
foreach (var fr in FirmwareDatabase.FirmwareRecords)
{
_resolutionDictionary.Remove(fr); // clear previous resolution results
FirmwareOption fo;
try
{
// check each acceptable option for this firmware, looking for the first that's in the reader's file list
fo = FirmwareDatabase.FirmwareOptions.First(fo1 => fo1.ID == fr.ID && fo1.IsAcceptableOrIdeal
&& reader.Dict.ContainsKey(fo1.Hash));
}
catch (InvalidOperationException)
{
continue; // didn't find any of them
}
// check each acceptable option for this firmware, looking for the first that's in the reader's file list
FirmwareOption fo = FirmwareDatabase.FirmwareOptions.FirstOrDefault(fo1 => fo1.ID == fr.ID && fo1.IsAcceptableOrIdeal && reader.Dict.ContainsKey(fo1.Hash));
if (fo.Size == 0)
continue;
// else found one, add it to the dict
_resolutionDictionary[fr] = new ResolutionInfo
{