Skip to content
Permalink
Browse files

If a project is missing a layer dependancy, don't abort out loading it

Otherwise we've effectively destroyed the project. Rather, continue
to load whatever layers we possibly can

Fixes #38562
  • Loading branch information
nyalldawson committed Sep 6, 2020
1 parent 08561d3 commit dd82478e262c23aca4e478fb3fc8264ec5fbd3a2
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/core/qgsproject.cpp
@@ -1068,9 +1068,13 @@ bool QgsProject::_getMapLayers( const QDomDocument &doc, QList<QDomNode> &broken
// order layers based on their dependencies
QgsScopedRuntimeProfile profile( tr( "Sorting layers" ), QStringLiteral( "projectload" ) );
QgsLayerDefinition::DependencySorter depSorter( doc );
if ( depSorter.hasCycle() || depSorter.hasMissingDependency() )
if ( depSorter.hasCycle() )
return false;

// Missing a dependency? We still load all the layers, otherwise the project is completely broken!
if ( depSorter.hasMissingDependency() )
returnStatus = false;

emit layerLoaded( 0, nl.count() );

const QVector<QDomNode> sortedLayerNodes = depSorter.sortedLayerNodes();

0 comments on commit dd82478

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