File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -65,10 +65,13 @@ void QgsAtlasComposition::setCoverageLayer( QgsVectorLayer* layer )
65
65
QgsExpression::setSpecialColumn ( " $numfeatures" , QVariant (( int )mFeatureIds .size () ) );
66
66
67
67
// Grab the first feature so that user can use it to test the style in rules.
68
- QgsFeature fet;
69
- layer->getFeatures ().nextFeature ( fet );
70
- QgsExpression::setSpecialColumn ( " $atlasfeatureid" , fet.id () );
71
- QgsExpression::setSpecialColumn ( " $atlasgeometry" , QVariant::fromValue ( *fet.geometry () ) );
68
+ if ( layer )
69
+ {
70
+ QgsFeature fet;
71
+ layer->getFeatures ().nextFeature ( fet );
72
+ QgsExpression::setSpecialColumn ( " $atlasfeatureid" , fet.id () );
73
+ QgsExpression::setSpecialColumn ( " $atlasgeometry" , QVariant::fromValue ( *fet.geometry () ) );
74
+ }
72
75
73
76
emit coverageLayerChanged ( layer );
74
77
}
@@ -663,6 +666,9 @@ void QgsAtlasComposition::setFilenamePattern( const QString& pattern )
663
666
664
667
void QgsAtlasComposition::updateFilenameExpression ()
665
668
{
669
+ if ( !mCoverageLayer )
670
+ return ;
671
+
666
672
const QgsFields& fields = mCoverageLayer ->pendingFields ();
667
673
668
674
if ( !mSingleFile && mFilenamePattern .size () > 0 )
You can’t perform that action at this time.
0 commit comments