Skip to content

Commit

Permalink
QgsVectorLayer::writeSymbology(): fix crash when called with invalid …
Browse files Browse the repository at this point in the history
…data provider
  • Loading branch information
rouault committed Oct 25, 2016
1 parent a70d428 commit 9ae1569
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/core/qgsvectorlayer.cpp
Expand Up @@ -1947,7 +1947,14 @@ bool QgsVectorLayer::writeSymbology( QDomNode& node, QDomDocument& doc, QString&
mConditionalStyles->writeXml( node, doc );

// save expression fields
mExpressionFieldBuffer->writeXml( node, doc );
if ( !mExpressionFieldBuffer )
{
// can happen when saving style on a invalid layer
QgsExpressionFieldBuffer dummy;
dummy.writeXml( node, doc );
}
else
mExpressionFieldBuffer->writeXml( node, doc );

// save readonly state
node.toElement().setAttribute( QStringLiteral( "readOnly" ), mReadOnly );
Expand Down

0 comments on commit 9ae1569

Please sign in to comment.