Skip to content
Permalink
Browse files

crash fix

  • Loading branch information
jef-n committed Nov 3, 2017
1 parent 5a316a6 commit 8f5468af3315fc269ee39437d271b73eeb3c7caa
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/core/layertree/qgslayertreemodel.cpp
@@ -416,7 +416,7 @@ bool QgsLayerTreeModel::setData( const QModelIndex &index, const QVariant &value

QModelIndex QgsLayerTreeModel::node2index( QgsLayerTreeNode *node ) const
{
if ( !node->parent() )
if ( !node || !node->parent() )
return QModelIndex(); // this is the only root item -> invalid index

QModelIndex parentIndex = node2index( node->parent() );
@@ -1171,7 +1171,7 @@ void QgsLayerTreeModel::removeLegendFromLayer( QgsLayerTreeLayer *nodeLayer )

void QgsLayerTreeModel::addLegendToLayer( QgsLayerTreeLayer *nodeL )
{
if ( !nodeL->layer() )
if ( !nodeL || !nodeL->layer() )
return;

QgsMapLayer *ml = nodeL->layer();

0 comments on commit 8f5468a

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