Skip to content
Permalink
Browse files

Fix project never completes loading layers when a layer has a missing…

… dependancy
  • Loading branch information
github-actions committed Sep 7, 2020
1 parent c8eae9b commit 5b55cad33979ee585d0dc50967d61b8534c45e81
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/core/qgsproject.cpp
@@ -951,13 +951,17 @@ bool QgsProject::_getMapLayers( const QDomDocument &doc, QList<QDomNode> &broken

bool returnStatus = true;

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

// order layers based on their dependencies
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();
const int totalLayerCount = sortedLayerNodes.count();

0 comments on commit 5b55cad

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