Skip to content
Permalink
Browse files

QgsVectorLayer::writeSymbology(): fix crash when called with invalid …

…data provider
  • Loading branch information
rouault committed Oct 25, 2016
1 parent a70d428 commit 9ae156970a124992bb8d4c1767831e433e284b00
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/core/qgsvectorlayer.cpp
@@ -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 );

0 comments on commit 9ae1569

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