Fix exception on opening Play Movie dialog with multiple movies

fixes 9211007a1
This commit is contained in:
YoshiRulz 2022-07-27 05:05:01 +10:00
parent bd58bde07c
commit 8453c0e44d
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 8 additions and 1 deletions

View File

@ -195,18 +195,25 @@ namespace BizHawk.Client.EmuHawk
}
// Prefer tas files
// but `_movieList` should only contain `.bk2` and `.tasproj` so... isn't that all of them? or, it is now I've fixed the case-sensitivity bug --yoshi
var tas = new List<int>();
for (var i = 0; i < indices.Count; i++)
{
foreach (var ext in MovieService.MovieExtensions)
{
if (Path.GetExtension(_movieList[indices[i]].Filename)?.ToUpper() == $".{ext}")
if ($".{ext}".Equals(Path.GetExtension(_movieList[indices[i]].Filename), StringComparison.InvariantCultureIgnoreCase))
{
tas.Add(i);
}
}
}
if (tas.Count is 0)
{
if (_movieList.Count is not 0) HighlightMovie(0);
return;
}
if (tas.Count == 1)
{
HighlightMovie(tas[0]);