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

View file

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