UI: Fixed crash in recent games initialization code (caused by previous commit)

This commit is contained in:
Sour 2019-12-05 23:35:08 -05:00
parent 63b23a7b22
commit 7afc52dc4b
2 changed files with 10 additions and 7 deletions

View file

@ -44,6 +44,10 @@ namespace Mesen.GUI.Controls
lblGameName.Text = Path.GetFileNameWithoutExtension(_recentGame.RomName);
lblSaveDate.Text = _recentGame.Timestamp.ToString();
lblGameName.Visible = true;
lblSaveDate.Visible = true;
picPreviousState.Visible = true;
Task.Run(() => {
Image img = null;
try {
@ -55,12 +59,11 @@ namespace Mesen.GUI.Controls
}
}
} catch { }
picPreviousState.Image = img;
});
lblGameName.Visible = true;
lblSaveDate.Visible = true;
picPreviousState.Visible = true;
this.BeginInvoke((Action)(() => {
picPreviousState.Image = img;
}));
});
}
}

View file

@ -126,8 +126,6 @@ namespace Mesen.GUI.Controls
public void Initialize()
{
InitGrid();
_initialized = true;
_recentGames = new List<RecentGameInfo>();
_currentIndex = 0;
@ -157,6 +155,8 @@ namespace Mesen.GUI.Controls
_recentGames.RemoveRange(36, _recentGames.Count - 36);
}
InitGrid();
if(_recentGames.Count == 0) {
this.Visible = false;
tmrInput.Enabled = false;