wx: Don't crash when loading from recent files a file

which is gone.
This commit is contained in:
riccardom 2010-06-24 09:36:04 +00:00
parent 90086cf357
commit f9353eab01
1 changed files with 8 additions and 2 deletions

View File

@ -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);
}