Skip to content

Commit 2b04c81

Browse files
committedApr 3, 2018
Fix some Coverity null pointer dereference warnings
1 parent 09241ea commit 2b04c81

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed
 

‎src/app/layout/qgslayoutdesignerdialog.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3003,7 +3003,7 @@ void QgsLayoutDesignerDialog::exportReportToRaster()
30033003
QFileInfo fi( fileNExt.first );
30043004
QString dir = fi.path();
30053005
QString fileName = dir + '/' + fi.baseName();
3006-
QgsLayoutExporter::ExportResult result = QgsLayoutExporter::exportToImage( dynamic_cast< QgsReport * >( mMasterLayout ), fileName, fileNExt.second, settings, error, feedback.get() );
3006+
QgsLayoutExporter::ExportResult result = QgsLayoutExporter::exportToImage( static_cast< QgsReport * >( mMasterLayout ), fileName, fileNExt.second, settings, error, feedback.get() );
30073007
cursorOverride.release();
30083008

30093009
switch ( result )
@@ -3118,7 +3118,7 @@ void QgsLayoutDesignerDialog::exportReportToSvg()
31183118
QFileInfo fi( outputFileName );
31193119
QString outFile = fi.path() + '/' + fi.baseName();
31203120
QString dir = fi.path();
3121-
QgsLayoutExporter::ExportResult result = QgsLayoutExporter::exportToSvg( dynamic_cast< QgsReport * >( mMasterLayout ), outFile, svgSettings, error, feedback.get() );
3121+
QgsLayoutExporter::ExportResult result = QgsLayoutExporter::exportToSvg( static_cast< QgsReport * >( mMasterLayout ), outFile, svgSettings, error, feedback.get() );
31223122

31233123
cursorOverride.release();
31243124
switch ( result )
@@ -3249,7 +3249,7 @@ void QgsLayoutDesignerDialog::exportReportToPdf()
32493249
feedback->cancel();
32503250
} );
32513251

3252-
QgsLayoutExporter::ExportResult result = QgsLayoutExporter::exportToPdf( dynamic_cast< QgsReport * >( mMasterLayout ), outputFileName, pdfSettings, error, feedback.get() );
3252+
QgsLayoutExporter::ExportResult result = QgsLayoutExporter::exportToPdf( static_cast< QgsReport * >( mMasterLayout ), outputFileName, pdfSettings, error, feedback.get() );
32533253
cursorOverride.release();
32543254

32553255
switch ( result )
@@ -3346,7 +3346,7 @@ void QgsLayoutDesignerDialog::printReport()
33463346
} );
33473347

33483348
QString printerName = printer()->printerName();
3349-
switch ( QgsLayoutExporter::print( dynamic_cast< QgsReport * >( mMasterLayout ), *printer(), printSettings, error, feedback.get() ) )
3349+
switch ( QgsLayoutExporter::print( static_cast< QgsReport * >( mMasterLayout ), *printer(), printSettings, error, feedback.get() ) )
33503350
{
33513351
case QgsLayoutExporter::Success:
33523352
{
@@ -3552,6 +3552,9 @@ void QgsLayoutDesignerDialog::createLayoutPropertiesWidget()
35523552
void QgsLayoutDesignerDialog::createAtlasWidget()
35533553
{
35543554
QgsPrintLayout *printLayout = dynamic_cast< QgsPrintLayout * >( mMasterLayout );
3555+
if ( !printLayout )
3556+
return;
3557+
35553558
QgsLayoutAtlas *atlas = printLayout->atlas();
35563559
QgsLayoutAtlasWidget *atlasWidget = new QgsLayoutAtlasWidget( mAtlasDock, printLayout );
35573560
atlasWidget->setMessageBar( mMessageBar );

0 commit comments

Comments
 (0)
Please sign in to comment.