Skip to content

Commit 19041a8

Browse files
author
Hugo Mercier
committed
Inverted renderer: make sure it works when no painter is here (feature count)
1 parent 7906154 commit 19041a8

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/core/symbology-ng/qgsinvertedpolygonrenderer.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ void QgsInvertedPolygonRenderer::startRender( QgsRenderContext& context, const Q
7373
// It must be computed in the destination CRS if reprojection is enabled.
7474
const QgsMapToPixel& mtp( context.mapToPixel() );
7575

76+
if ( !context.painter() )
77+
{
78+
return;
79+
}
80+
7681
// convert viewport to dest CRS
7782
QRect e( context.painter()->viewport() );
7883
// add some space to hide borders and tend to infinity
@@ -102,7 +107,10 @@ void QgsInvertedPolygonRenderer::startRender( QgsRenderContext& context, const Q
102107

103108
bool QgsInvertedPolygonRenderer::renderFeature( QgsFeature& feature, QgsRenderContext& context, int layer, bool selected, bool drawVertexMarker )
104109
{
105-
Q_UNUSED( context );
110+
if ( !context.painter() )
111+
{
112+
return false;
113+
}
106114

107115
// store this feature as a feature to render with decoration if needed
108116
if ( selected || drawVertexMarker )
@@ -223,6 +231,10 @@ void QgsInvertedPolygonRenderer::stopRender( QgsRenderContext& context )
223231
if ( !mSubRenderer ) {
224232
return;
225233
}
234+
if ( !context.painter() )
235+
{
236+
return;
237+
}
226238

227239
for ( FeatureCategoryMap::iterator cit = mFeaturesCategoryMap.begin(); cit != mFeaturesCategoryMap.end(); ++cit)
228240
{

0 commit comments

Comments
 (0)