Skip to content

Commit a7096ae

Browse files
committed
Fix some Coverity null pointer dereference warnings
(cherry-picked from 2b04c81)
1 parent 434ee39 commit a7096ae

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
@@ -2992,7 +2992,7 @@ void QgsLayoutDesignerDialog::exportReportToRaster()
29922992
QFileInfo fi( fileNExt.first );
29932993
QString dir = fi.path();
29942994
QString fileName = dir + '/' + fi.baseName();
2995-
QgsLayoutExporter::ExportResult result = QgsLayoutExporter::exportToImage( dynamic_cast< QgsReport * >( mMasterLayout ), fileName, fileNExt.second, settings, error, feedback.get() );
2995+
QgsLayoutExporter::ExportResult result = QgsLayoutExporter::exportToImage( static_cast< QgsReport * >( mMasterLayout ), fileName, fileNExt.second, settings, error, feedback.get() );
29962996
QApplication::restoreOverrideCursor();
29972997

29982998
switch ( result )
@@ -3107,7 +3107,7 @@ void QgsLayoutDesignerDialog::exportReportToSvg()
31073107
QFileInfo fi( outputFileName );
31083108
QString outFile = fi.path() + '/' + fi.baseName();
31093109
QString dir = fi.path();
3110-
QgsLayoutExporter::ExportResult result = QgsLayoutExporter::exportToSvg( dynamic_cast< QgsReport * >( mMasterLayout ), outFile, svgSettings, error, feedback.get() );
3110+
QgsLayoutExporter::ExportResult result = QgsLayoutExporter::exportToSvg( static_cast< QgsReport * >( mMasterLayout ), outFile, svgSettings, error, feedback.get() );
31113111

31123112
QApplication::restoreOverrideCursor();
31133113
switch ( result )
@@ -3238,7 +3238,7 @@ void QgsLayoutDesignerDialog::exportReportToPdf()
32383238
feedback->cancel();
32393239
} );
32403240

3241-
QgsLayoutExporter::ExportResult result = QgsLayoutExporter::exportToPdf( dynamic_cast< QgsReport * >( mMasterLayout ), outputFileName, pdfSettings, error, feedback.get() );
3241+
QgsLayoutExporter::ExportResult result = QgsLayoutExporter::exportToPdf( static_cast< QgsReport * >( mMasterLayout ), outputFileName, pdfSettings, error, feedback.get() );
32423242

32433243
switch ( result )
32443244
{
@@ -3335,7 +3335,7 @@ void QgsLayoutDesignerDialog::printReport()
33353335
} );
33363336

33373337
QString printerName = printer()->printerName();
3338-
switch ( QgsLayoutExporter::print( dynamic_cast< QgsReport * >( mMasterLayout ), *printer(), printSettings, error, feedback.get() ) )
3338+
switch ( QgsLayoutExporter::print( static_cast< QgsReport * >( mMasterLayout ), *printer(), printSettings, error, feedback.get() ) )
33393339
{
33403340
case QgsLayoutExporter::Success:
33413341
{
@@ -3539,6 +3539,9 @@ void QgsLayoutDesignerDialog::createLayoutPropertiesWidget()
35393539
void QgsLayoutDesignerDialog::createAtlasWidget()
35403540
{
35413541
QgsPrintLayout *printLayout = dynamic_cast< QgsPrintLayout * >( mMasterLayout );
3542+
if ( !printLayout )
3543+
return;
3544+
35423545
QgsLayoutAtlas *atlas = printLayout->atlas();
35433546
QgsLayoutAtlasWidget *atlasWidget = new QgsLayoutAtlasWidget( mAtlasDock, printLayout );
35443547
atlasWidget->setMessageBar( mMessageBar );

0 commit comments

Comments
 (0)