Skip to content

Commit 8024df7

Browse files
committed
Don't crash if embedded group cannot be loaded (Fix #7872)
1 parent b3d184d commit 8024df7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/app/legend/qgslegend.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,11 +1845,14 @@ bool QgsLegend::readXML( QgsLegendGroup *parent, const QDomNode &node )
18451845
if ( childelem.attribute( "embedded" ) == "1" )
18461846
{
18471847
theGroup = addEmbeddedGroup( name, QgsProject::instance()->readPath( childelem.attribute( "project" ) ) );
1848-
if ( childelem.hasAttribute( "drawingOrder" ) )
1848+
if ( theGroup )
18491849
{
1850-
theGroup->setDrawingOrder( childelem.attribute( "drawingOrder" ).toInt() );
1850+
if ( childelem.hasAttribute( "drawingOrder" ) )
1851+
{
1852+
theGroup->setDrawingOrder( childelem.attribute( "drawingOrder" ).toInt() );
1853+
}
1854+
updateGroupCheckStates( theGroup );
18511855
}
1852-
updateGroupCheckStates( theGroup );
18531856
}
18541857
else
18551858
{

0 commit comments

Comments
 (0)