Skip to content
Permalink
Browse files

Fix reading project properties fails if any child element

has a tag named "properties"
  • Loading branch information
nyalldawson committed Feb 5, 2017
1 parent be9e93d commit ac55f396ddd663a73e84660f50956bbee9374d33
Showing with 4 additions and 12 deletions.
  1. +4 −12 src/core/qgsproject.cpp
@@ -519,30 +519,22 @@ scope. "layers" is a list containing three string values.
*/
void _getProperties( const QDomDocument& doc, QgsProjectPropertyKey& project_properties )
{
QDomNodeList properties = doc.elementsByTagName( QStringLiteral( "properties" ) );
QDomElement propertiesElem = doc.documentElement().firstChildElement( QStringLiteral( "properties" ) );

if ( properties.count() > 1 )
{
QgsDebugMsg( "there appears to be more than one ``properties'' XML tag ... bailing" );
return;
}
else if ( properties.count() < 1 ) // no properties found, so we're done
if ( propertiesElem.isNull() ) // no properties found, so we're done
{
return;
}

// item(0) because there should only be ONE "properties" node
QDomNodeList scopes = properties.item( 0 ).childNodes();
QDomNodeList scopes = propertiesElem.childNodes();

if ( scopes.count() < 1 )
{
QgsDebugMsg( "empty ``properties'' XML tag ... bailing" );
return;
}

QDomNode propertyNode = properties.item( 0 );

if ( ! project_properties.readXml( propertyNode ) )
if ( ! project_properties.readXml( propertiesElem ) )
{
QgsDebugMsg( "Project_properties.readXml() failed" );
}

0 comments on commit ac55f39

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