Skip to content
Permalink
Browse files
QgsRasterLayer::writeXml(): fix crash on invalid layer
  • Loading branch information
rouault committed Apr 10, 2021
1 parent d7ba20b commit 6981603178e971763fa9f9be9dae343bad6b9706
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/core/raster/qgsrasterlayer.cpp
@@ -311,6 +311,9 @@ QgsLegendColorList QgsRasterLayer::legendSymbologyItems() const

QString QgsRasterLayer::htmlMetadata() const
{
if ( !mDataProvider )
return QString();

QgsLayerMetadataFormatter htmlFormatter( metadata() );
QString myMetadata = QStringLiteral( "<html><head></head>\n<body>\n" );

@@ -2173,6 +2176,9 @@ bool QgsRasterLayer::writeXml( QDomNode &layer_node,
QDomDocument &document,
const QgsReadWriteContext &context ) const
{
if ( !mDataProvider )
return false;

// first get the layer element so that we can append the type attribute

QDomElement mapLayerNode = layer_node.toElement();

0 comments on commit 6981603

Please sign in to comment.