Debugger: Fixed UI crash in watch when typing an hex address without the hex prefix

This commit is contained in:
Sour 2020-02-14 16:33:06 -05:00
parent effd016dc7
commit a48e52933b

View file

@ -182,7 +182,11 @@ namespace Mesen.GUI.Debugger
if(address[0] >= '0' && address[0] <= '9' || address[0] == '$') {
//CPU Address
_selectedAddress = Int32.Parse(address[0] == '$' ? address.Substring(1) : address, address[0] == '$' ? NumberStyles.AllowHexSpecifier : NumberStyles.None);
bool isHex = address[0] == '$';
string addrString = isHex ? address.Substring(1) : address;
if(!Int32.TryParse(addrString, isHex ? NumberStyles.AllowHexSpecifier : NumberStyles.None, null, out _selectedAddress)) {
_selectedAddress = -1;
}
_selectedLabel = null;
mnuEditInMemoryViewer.Enabled = true;
mnuViewInDisassembly.Enabled = true;