From a48e52933bcee6396ea832c167d88d4a6fc9f151 Mon Sep 17 00:00:00 2001 From: Sour Date: Fri, 14 Feb 2020 16:33:06 -0500 Subject: [PATCH] Debugger: Fixed UI crash in watch when typing an hex address without the hex prefix --- GUI.NET/Debugger/Controls/ctrlWatch.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/GUI.NET/Debugger/Controls/ctrlWatch.cs b/GUI.NET/Debugger/Controls/ctrlWatch.cs index 9b455b9d..9389afbd 100644 --- a/GUI.NET/Debugger/Controls/ctrlWatch.cs +++ b/GUI.NET/Debugger/Controls/ctrlWatch.cs @@ -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;