Ensure filetype is not null before using open command, Fixed if statements to follow coding guidelines
This commit is contained in:
+7
-4
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user