File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -686,9 +686,14 @@ QgsExpressionContextScope* QgsExpressionContextUtils::layerScope( const QgsMapLa
686
686
QList<QgsExpressionContextScope*> QgsExpressionContextUtils::globalProjectLayerScopes ( const QgsMapLayer* layer )
687
687
{
688
688
QList<QgsExpressionContextScope*> scopes;
689
- scopes << globalScope ()
690
- << projectScope ( QgsProject::instance () ) // TODO: use project associated with layer
691
- << layerScope ( layer );
689
+ scopes << globalScope ();
690
+
691
+ QgsProject* project = QgsProject::instance (); // TODO: use project associated with layer
692
+ if ( project )
693
+ scopes << projectScope ( project );
694
+
695
+ if ( layer )
696
+ scopes << layerScope ( layer );
692
697
return scopes;
693
698
}
694
699
Original file line number Diff line number Diff line change @@ -93,6 +93,7 @@ QList<QgsExpressionContextScope *> QgsSymbolWidgetContext::globalProjectAtlasMap
93
93
{
94
94
scopes << QgsExpressionContextUtils::mapSettingsScope ( QgsMapSettings () );
95
95
}
96
- scopes << QgsExpressionContextUtils::layerScope ( layer );
96
+ if ( layer )
97
+ scopes << QgsExpressionContextUtils::layerScope ( layer );
97
98
return scopes;
98
99
}
You can’t perform that action at this time.
0 commit comments