Fixed endless while loop

This commit is contained in:
erri120 2019-10-11 19:29:11 +02:00
parent 6fa03cbc5d
commit 775354b4d9
No known key found for this signature in database
GPG Key ID: A8C0A18D8D4D3135

View File

@ -81,15 +81,15 @@ namespace Wabbajack.UI
{
var idx = _random.Next(0, SlideShowElements.Count);
var randomSlide = SlideShowElements[idx];
while (CachedSlides.ContainsKey(randomSlide.ModID) || SlidesQueue.Contains(randomSlide))
while (!CachedSlides.ContainsKey(randomSlide.ModID) || SlidesQueue.Contains(randomSlide))
{
idx = _random.Next(0, SlideShowElements.Count);
randomSlide = SlideShowElements[idx];
}
if (!CachedSlides.ContainsKey(randomSlide.ModID)) continue;
//if (SlidesQueue.Contains(randomSlide)) continue;
CachedSlides.Remove(randomSlide.ModID);
if(AppState.GcCollect)
if (AppState.GcCollect)
GC.Collect();
}