Skip to content
Permalink
Browse files

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

… dependancy
  • Loading branch information
github-actions authored and nyalldawson committed Sep 7, 2020
1 parent d031ec0 commit 93b4d20cb3120ea2479a156e9cd42ab3b59dfa05
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/core/qgsproject.cpp
@@ -1050,13 +1050,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 93b4d20

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