Skip to content
Permalink
Browse files

Null pointer check for the layer tree

  • Loading branch information
rldhont committed Sep 6, 2017
1 parent 0598be4 commit 388f8630f36aa00095bef22cf38e401a7df75f63
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/core/layertree/qgslayertreemodellegendnode.cpp
@@ -137,6 +137,7 @@ QgsSymbolLegendNode::QgsSymbolLegendNode( QgsLayerTreeLayer *nodeLayer, const Qg
{
updateLabel();
connect( qobject_cast<QgsVectorLayer *>( nodeLayer->layer() ), &QgsVectorLayer::symbolFeatureCountMapChanged, this, &QgsSymbolLegendNode::updateLabel );
connect( nodeLayer, &QObject::destroyed, this, [ = ]() { mLayerNode = nullptr; } );

if ( mItem.symbol() )
mSymbolUsesMapUnits = ( mItem.symbol()->outputUnit() != QgsUnitTypes::RenderMillimeters );
@@ -444,6 +445,9 @@ void QgsSymbolLegendNode::invalidateMapBasedData()

void QgsSymbolLegendNode::updateLabel()
{
if ( !mLayerNode )
return;

bool showFeatureCount = mLayerNode->customProperty( QStringLiteral( "showFeatureCount" ), 0 ).toBool();
QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( mLayerNode->layer() );

0 comments on commit 388f863

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