Ensure filetype is not null before using open command, Fixed if statements to follow coding guidelines
This commit is contained in:
parent
57d4c90055
commit
0d9ffb11fa
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
void AddDelimiterString( wxString& string )
|
void AddDelimiterString( wxString& string )
|
||||||
{
|
{
|
||||||
if ( !string.StartsWith( wxT( "\"" ) ) )
|
if( !string.StartsWith( wxT( "\"" ) ) )
|
||||||
{
|
{
|
||||||
string.Prepend ( wxT( "\"" ) );
|
string.Prepend ( wxT( "\"" ) );
|
||||||
string.Append ( wxT( "\"" ) );
|
string.Append ( wxT( "\"" ) );
|
||||||
|
@ -358,13 +358,16 @@ bool OpenPDF( const wxString& file )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxFileType* filetype = wxTheMimeTypesManager->GetFileTypeFromExtension( wxT( "pdf" ) );
|
wxFileType* filetype = wxTheMimeTypesManager->GetFileTypeFromExtension( wxT( "pdf" ) );
|
||||||
command = filetype->GetOpenCommand( filename );
|
|
||||||
|
if( filetype )
|
||||||
|
command = filetype->GetOpenCommand( filename );
|
||||||
|
|
||||||
delete filetype;
|
delete filetype;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !command.IsEmpty() )
|
if( !command.IsEmpty() )
|
||||||
{
|
{
|
||||||
if ( ProcessExecute( command ) )
|
if( ProcessExecute( command ) )
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue