From 7f996f5b4bb0701c0d09f71f92d41694d389ace0 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Thu, 4 Feb 2021 21:43:19 -0800 Subject: [PATCH] Windows: Prevent crash on null symbol map. Happened during a double error scenario, but might as well check. --- Windows/WindowsHost.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Windows/WindowsHost.cpp b/Windows/WindowsHost.cpp index d7b3d93396de..5a14a4538073 100644 --- a/Windows/WindowsHost.cpp +++ b/Windows/WindowsHost.cpp @@ -261,7 +261,8 @@ void WindowsHost::PollControllers() { } void WindowsHost::BootDone() { - g_symbolMap->SortSymbols(); + if (g_symbolMap) + g_symbolMap->SortSymbols(); PostMessage(mainWindow_, WM_USER + 1, 0, 0); SetDebugMode(!g_Config.bAutoRun); @@ -295,6 +296,8 @@ static std::string SymbolMapFilename(const char *currentFilename, const char* ex } bool WindowsHost::AttemptLoadSymbolMap() { + if (!g_symbolMap) + return false; bool result1 = g_symbolMap->LoadSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart.c_str(),".ppmap").c_str()); // Load the old-style map file. if (!result1) @@ -304,11 +307,13 @@ bool WindowsHost::AttemptLoadSymbolMap() { } void WindowsHost::SaveSymbolMap() { - g_symbolMap->SaveSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart.c_str(),".ppmap").c_str()); + if (g_symbolMap) + g_symbolMap->SaveSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart.c_str(),".ppmap").c_str()); } void WindowsHost::NotifySymbolMapUpdated() { - g_symbolMap->SortSymbols(); + if (g_symbolMap) + g_symbolMap->SortSymbols(); PostMessage(mainWindow_, WM_USER + 1, 0, 0); }