Skip to content
Permalink
Browse files

handle bad layers when custom layer order is set (fixes #12733)

(cherry picked from commit 78c60a2)
  • Loading branch information
jef-n committed Jun 11, 2015
1 parent 10fbfcf commit 99df33fb34184f406e71593de8adfd8466865d25
Showing with 11 additions and 0 deletions.
  1. +11 −0 src/gui/layertree/qgslayertreemapcanvasbridge.cpp
@@ -86,6 +86,17 @@ void QgsLayerTreeMapCanvasBridge::setCustomLayerOrder( const QStringList& order
QStringList sortedNewOrder = order;
qSort( defOrder );
qSort( sortedNewOrder );

if ( defOrder.size() < sortedNewOrder.size() )
{
// some bad layers in the list?
for ( int i = 0; i < sortedNewOrder.size(); i++ )
{
if ( i >= defOrder.size() || defOrder[i] != sortedNewOrder[i] )
sortedNewOrder.removeAt( i-- );
}
}

if ( defOrder != sortedNewOrder )
return; // must be permutation of the default order

0 comments on commit 99df33f

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