Merge pull request #2673 from Armada651/cheat-crash

CheatSearchTab: Check Core state instead of checking a memory pointer.
This commit is contained in:
Jules Blok 2015-06-29 11:02:16 +02:00
commit 9a244f07fa
1 changed files with 3 additions and 2 deletions

View File

@ -17,6 +17,7 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/ActionReplay.h" #include "Core/ActionReplay.h"
#include "Core/Core.h"
#include "Core/HW/Memmap.h" #include "Core/HW/Memmap.h"
#include "DolphinWX/WxUtils.h" #include "DolphinWX/WxUtils.h"
#include "DolphinWX/Cheats/CheatSearchTab.h" #include "DolphinWX/Cheats/CheatSearchTab.h"
@ -125,7 +126,7 @@ CheatSearchTab::CheatSearchTab(wxWindow* const parent)
void CheatSearchTab::StartNewSearch(wxCommandEvent& WXUNUSED(event)) void CheatSearchTab::StartNewSearch(wxCommandEvent& WXUNUSED(event))
{ {
const u8* const memptr = Memory::m_pRAM; const u8* const memptr = Memory::m_pRAM;
if (memptr == nullptr) if (!Core::IsRunningAndStarted())
{ {
WxUtils::ShowErrorDialog(_("A game is not currently running.")); WxUtils::ShowErrorDialog(_("A game is not currently running."));
return; return;
@ -157,7 +158,7 @@ void CheatSearchTab::StartNewSearch(wxCommandEvent& WXUNUSED(event))
void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&) void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&)
{ {
const u8* const memptr = Memory::m_pRAM; const u8* const memptr = Memory::m_pRAM;
if (memptr == nullptr) if (!Core::IsRunningAndStarted())
{ {
WxUtils::ShowErrorDialog(_("A game is not currently running.")); WxUtils::ShowErrorDialog(_("A game is not currently running."));
return; return;