Ooops, fix crash when attempting to display the game name from a commit I made recently

This commit is contained in:
adelikat 2014-05-12 20:51:09 +00:00
parent 490a3dc3cf
commit 353fe15845
1 changed files with 9 additions and 4 deletions

View File

@ -33,7 +33,7 @@ namespace BizHawk.Client.EmuHawk
private void MainForm_Load(object sender, EventArgs e) private void MainForm_Load(object sender, EventArgs e)
{ {
Text = "BizHawk" + (VersionInfo.INTERIM ? " (interim) " : String.Empty); Text = "BizHawk" + (VersionInfo.INTERIM ? " (interim) " : string.Empty);
Global.CheatList.Changed += ToolHelpers.UpdateCheatRelatedTools; Global.CheatList.Changed += ToolHelpers.UpdateCheatRelatedTools;
@ -925,7 +925,7 @@ namespace BizHawk.Client.EmuHawk
} }
else else
{ {
CheatStatusButton.ToolTipText = String.Empty; CheatStatusButton.ToolTipText = string.Empty;
CheatStatusButton.Image = Properties.Resources.Blank; CheatStatusButton.Image = Properties.Resources.Blank;
CheatStatusButton.Visible = false; CheatStatusButton.Visible = false;
} }
@ -1466,7 +1466,7 @@ namespace BizHawk.Client.EmuHawk
{ {
PauseStatusButton.Image = Properties.Resources.Blank; PauseStatusButton.Image = Properties.Resources.Blank;
PauseStatusButton.Visible = false; PauseStatusButton.Visible = false;
PauseStatusButton.ToolTipText = String.Empty; PauseStatusButton.ToolTipText = string.Empty;
} }
} }
@ -2992,13 +2992,18 @@ namespace BizHawk.Client.EmuHawk
Global.Game.Status = nes.RomStatus; Global.Game.Status = nes.RomStatus;
} }
string gamename = Path.GetFileNameWithoutExtension(path); string gamename = string.Empty;
if (!string.IsNullOrWhiteSpace(loader.Game.Name)) // Prefer Game db name, else use the path if (!string.IsNullOrWhiteSpace(loader.Game.Name)) // Prefer Game db name, else use the path
{ {
gamename = loader.Game.Name; gamename = loader.Game.Name;
} }
else
{
gamename = Path.GetFileNameWithoutExtension(path.Split('|').Last());
}
Text = DisplayNameForSystem(loader.Game.System) + " - " + gamename; Text = DisplayNameForSystem(loader.Game.System) + " - " + gamename;
Global.Rewinder.ResetRewindBuffer(); Global.Rewinder.ResetRewindBuffer();
if (Global.Emulator.CoreComm.RomStatusDetails == null && loader.Rom != null) if (Global.Emulator.CoreComm.RomStatusDetails == null && loader.Rom != null)