Ensure filetype is not null before using open command, Fixed if statements to follow coding guidelines

This commit is contained in:
Simon Wells 2016-01-01 20:51:50 +13:00
parent 57d4c90055
commit 0d9ffb11fa
1 changed files with 7 additions and 4 deletions

View File

@ -44,7 +44,7 @@
void AddDelimiterString( wxString& string )
{
if ( !string.StartsWith( wxT( "\"" ) ) )
if( !string.StartsWith( wxT( "\"" ) ) )
{
string.Prepend ( wxT( "\"" ) );
string.Append ( wxT( "\"" ) );
@ -358,13 +358,16 @@ bool OpenPDF( const wxString& file )
else
{
wxFileType* filetype = wxTheMimeTypesManager->GetFileTypeFromExtension( wxT( "pdf" ) );
command = filetype->GetOpenCommand( filename );
if( filetype )
command = filetype->GetOpenCommand( filename );
delete filetype;
}
if ( !command.IsEmpty() )
if( !command.IsEmpty() )
{
if ( ProcessExecute( command ) )
if( ProcessExecute( command ) )
{
return true;
}