Skip to content

Commit

Permalink
crash fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Nov 3, 2017
1 parent 5a316a6 commit 8f5468a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/layertree/qgslayertreemodel.cpp
Expand Up @@ -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() );
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 8f5468a

Please sign in to comment.