Skip to content
Permalink
Browse files

atlas: don't crash the coverage layer is removed (refs #9779)

  • Loading branch information
jef-n committed Mar 14, 2014
1 parent 3224a2f commit 1a67988e593b94c1818a81a79580bea7bce37aac
Showing with 10 additions and 4 deletions.
  1. +10 −4 src/core/composer/qgsatlascomposition.cpp
@@ -65,10 +65,13 @@ void QgsAtlasComposition::setCoverageLayer( QgsVectorLayer* layer )
QgsExpression::setSpecialColumn( "$numfeatures", QVariant(( int )mFeatureIds.size() ) );

// Grab the first feature so that user can use it to test the style in rules.
QgsFeature fet;
layer->getFeatures().nextFeature( fet );
QgsExpression::setSpecialColumn( "$atlasfeatureid", fet.id() );
QgsExpression::setSpecialColumn( "$atlasgeometry", QVariant::fromValue( *fet.geometry() ) );
if( layer )
{
QgsFeature fet;
layer->getFeatures().nextFeature( fet );
QgsExpression::setSpecialColumn( "$atlasfeatureid", fet.id() );
QgsExpression::setSpecialColumn( "$atlasgeometry", QVariant::fromValue( *fet.geometry() ) );
}

emit coverageLayerChanged( layer );
}
@@ -663,6 +666,9 @@ void QgsAtlasComposition::setFilenamePattern( const QString& pattern )

void QgsAtlasComposition::updateFilenameExpression()
{
if ( !mCoverageLayer )
return;

const QgsFields& fields = mCoverageLayer->pendingFields();

if ( !mSingleFile && mFilenamePattern.size() > 0 )

0 comments on commit 1a67988

Please sign in to comment.
You can’t perform that action at this time.