From 4c2969712032039c36699aa7b0f16472f6894d33 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 23 May 2020 10:26:47 -0700 Subject: [PATCH] Debugger: Avoid symbol map if deleted. This isn't perfectly safe, but if the game quits very quickly, it's possible for the symbol map to get deleted. --- Windows/Debugger/Debugger_Disasm.cpp | 8 ++++---- Windows/Debugger/Debugger_MemoryDlg.cpp | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Windows/Debugger/Debugger_Disasm.cpp b/Windows/Debugger/Debugger_Disasm.cpp index 4a2e54ee9d..112f854ab1 100644 --- a/Windows/Debugger/Debugger_Disasm.cpp +++ b/Windows/Debugger/Debugger_Disasm.cpp @@ -597,10 +597,9 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) break; case IDC_ALLFUNCTIONS: - { + if (g_symbolMap) g_symbolMap->FillSymbolListBox(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST),ST_FUNCTION); - break; - } + break; default: return FALSE; } @@ -862,7 +861,8 @@ void CDisasm::SetDebugMode(bool _bDebug, bool switchPC) void CDisasm::NotifyMapLoaded() { - g_symbolMap->FillSymbolListBox(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST),ST_FUNCTION); + if (g_symbolMap) + g_symbolMap->FillSymbolListBox(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST),ST_FUNCTION); CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); ptr->clearFunctions(); ptr->redraw(); diff --git a/Windows/Debugger/Debugger_MemoryDlg.cpp b/Windows/Debugger/Debugger_MemoryDlg.cpp index 6943a8b1a3..dd4a3b91ce 100644 --- a/Windows/Debugger/Debugger_MemoryDlg.cpp +++ b/Windows/Debugger/Debugger_MemoryDlg.cpp @@ -95,7 +95,8 @@ void CMemoryDlg::NotifyMapLoaded() if (m_hDlg) { HWND list = GetDlgItem(m_hDlg,IDC_SYMBOLS); - g_symbolMap->FillSymbolListBox(list,ST_DATA); + if (g_symbolMap) + g_symbolMap->FillSymbolListBox(list, ST_DATA); HWND lb = GetDlgItem(m_hDlg,IDC_REGIONS); int sel = ComboBox_GetCurSel(lb); ComboBox_ResetContent(lb);