From 05d2e470bfcf99cd8b553fc9370ea606a71ef585 Mon Sep 17 00:00:00 2001 From: Sonicadvance1 Date: Tue, 9 Dec 2008 23:19:44 +0000 Subject: [PATCH] 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 --- Source/Core/DolphinWX/Src/ISOProperties.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Source/Core/DolphinWX/Src/ISOProperties.cpp b/Source/Core/DolphinWX/Src/ISOProperties.cpp index 96f1982d37..dd4298929e 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.cpp +++ b/Source/Core/DolphinWX/Src/ISOProperties.cpp @@ -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();