Skip to content
Permalink
Browse files
QgsLayoutUtils::predefinedScales(): avoid potential nullptr dereference
  • Loading branch information
rouault authored and nyalldawson committed Jul 22, 2021
1 parent 2107733 commit 1233c89d7e0db2485dd96b4262c8e70aa6bd69b4
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/core/layout/qgslayoututils.cpp
@@ -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

0 comments on commit 1233c89

Please sign in to comment.