Skip to content

Commit

Permalink
Fix DOM elem retrieval for test
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Dec 10, 2020
1 parent de30d7c commit 43a1526
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/core/layertree/qgslayertreeutils.cpp
Expand Up @@ -25,9 +25,6 @@
static void _readOldLegendGroup( const QDomElement &groupElem, QgsLayerTreeGroup *parent );
static void _readOldLegendLayer( const QDomElement &layerElem, QgsLayerTreeGroup *parent );




bool QgsLayerTreeUtils::readOldLegend( QgsLayerTreeGroup *root, const QDomElement &legendElem )
{
if ( legendElem.isNull() )
Expand Down
5 changes: 5 additions & 0 deletions src/core/qgslayerdefinition.cpp
Expand Up @@ -357,6 +357,11 @@ void QgsLayerDefinition::DependencySorter::init( const QDomDocument &doc )
{
layerElem = doc.documentElement().firstChildElement( QStringLiteral( "maplayers" ) ).firstChildElement( QStringLiteral( "maplayer" ) );
}
// For tests (I don't know if there is a real use case for such a document except for test_qgslayerdefinition.py)
if ( layerElem.isNull() )
{
layerElem = doc.documentElement().firstChildElement( QStringLiteral( "maplayer" ) );
}

const QDomElement &firstElement { layerElem };

Expand Down

0 comments on commit 43a1526

Please sign in to comment.