From f9353eab015c38a164c760d5597714ed5bd597a3 Mon Sep 17 00:00:00 2001 From: riccardom Date: Thu, 24 Jun 2010 09:36:04 +0000 Subject: [PATCH] wx: Don't crash when loading from recent files a file which is gone. --- desmume/src/wx/wxMain.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/desmume/src/wx/wxMain.cpp b/desmume/src/wx/wxMain.cpp index 175073472..26e8177b3 100644 --- a/desmume/src/wx/wxMain.cpp +++ b/desmume/src/wx/wxMain.cpp @@ -860,6 +860,12 @@ void DesmumeFrame::OnClose(wxCloseEvent &event) { } void DesmumeFrame::OnOpenRecent(wxCommandEvent &event) { - execute = true; - NDS_LoadROM(history->GetHistoryFile(event.GetId()-wxID_FILE1).mb_str(),NULL); + int ret; + size_t id = event.GetId()-wxID_FILE1; + + ret = NDS_LoadROM(history->GetHistoryFile(id).mb_str(), history->GetHistoryFile(id).mb_str()); + if (ret > 0) + execute = true; + else + history->RemoveFileFromHistory(id); }