Skip to content

Commit

Permalink
QgsLayoutUtils::predefinedScales(): avoid potential nullptr dereference
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault authored and nyalldawson committed Jul 22, 2021
1 parent 2107733 commit 1233c89
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/core/layout/qgslayoututils.cpp
Expand Up @@ -512,11 +512,12 @@ double QgsLayoutUtils::mmToPoints( const double mmSize )

QVector< double > QgsLayoutUtils::predefinedScales( const QgsLayout *layout )
{
QgsProject *lProject = layout->project();
QVector< double > mapScales;
if ( layout->project() )
mapScales = layout->project()->viewSettings()->mapScales();
if ( lProject )
mapScales = lProject->viewSettings()->mapScales();

bool hasProjectScales( layout->project()->viewSettings()->useProjectScales() );
bool hasProjectScales( lProject ? lProject->viewSettings()->useProjectScales() : false );
if ( !hasProjectScales || mapScales.isEmpty() )
{
// default to global map tool scales
Expand Down

0 comments on commit 1233c89

Please sign in to comment.