Skip to content

Commit

Permalink
handle bad layers when custom layer order is set (fixes #12733)
Browse files Browse the repository at this point in the history
(cherry picked from commit 78c60a2)
  • Loading branch information
jef-n committed Jun 29, 2015
1 parent 10fbfcf commit 99df33f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/gui/layertree/qgslayertreemapcanvasbridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 99df33f

Please sign in to comment.