Made opening the ISO file more safe, so it doesn't seg fault when it can't find the filetype from extension and etc.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1469 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Sonicadvance1 2008-12-09 23:19:44 +00:00
parent 0e47a7986d
commit 05d2e470bf

View File

@ -585,7 +585,18 @@ void CISOProperties::OnEditConfig(wxCommandEvent& WXUNUSED (event))
SaveGameConfig();
wxFileType* filetype = wxTheMimeTypesManager->GetFileTypeFromExtension(_("ini"));
wxExecute(filetype->GetOpenCommand(wxString::FromAscii(GameIniFile.c_str())), wxEXEC_SYNC);
if(filetype == NULL)
{
PanicAlert("Filetype 'ini' is unknown! Will not open!");
return;
}
wxString OpenCommand;
OpenCommand = filetype->GetOpenCommand(wxString::FromAscii(GameIniFile.c_str()));
if(OpenCommand.IsEmpty())
PanicAlert("Couldn't find open command for extension 'ini'!");
else
if(wxExecute(OpenCommand, wxEXEC_SYNC) == -1)
PanicAlert("wxExecute returned -1 on application run!");
GameIni.Load(GameIniFile.c_str());
LoadGameConfig();