Skip to content
Permalink
Browse files

Don't try to label empty geometries

Fixes #33931
  • Loading branch information
nyalldawson authored and m-kuhn committed Jan 21, 2020
1 parent ce2f3f9 commit 11449743788f3fd346c01c46cff01bcf3f84edf0
Showing with 5 additions and 5 deletions.
  1. +2 −2 src/core/labeling/qgspallabeling.cpp
  2. +3 −3 tests/src/core/testqgslabelingengine.cpp
@@ -1957,7 +1957,7 @@ void QgsPalLayerSettings::registerFeature( const QgsFeature &f, QgsRenderContext
{
geom = QgsPalLabeling::prepareGeometry( geom, context, ct, doClip ? extentGeom : QgsGeometry(), mergeLines );

if ( geom.isNull() )
if ( geom.isEmpty() )
return;
}
geos_geom_clone = QgsGeos::asGeos( geom );
@@ -3577,7 +3577,7 @@ QgsGeometry QgsPalLabeling::prepareGeometry( const QgsGeometry &geometry, QgsRen
|| ( !qgsDoubleNear( m2p.mapRotation(), 0 ) && !clipGeometry.contains( geom ) ) ) )
{
QgsGeometry clipGeom = geom.intersection( clipGeometry ); // creates new geometry
if ( clipGeom.isNull() )
if ( clipGeom.isEmpty() )
{
return QgsGeometry();
}
@@ -565,7 +565,7 @@ void TestQgsLabelingEngine::testSubstitutions()

QgsVectorLayerLabelProvider *provider = new QgsVectorLayerLabelProvider( vl, QStringLiteral( "test" ), true, &settings );
QgsFeature f( vl->fields(), 1 );
f.setGeometry( QgsGeometry::fromPointXY( QgsPointXY( 1, 2 ) ) );
f.setGeometry( QgsGeometry::fromPointXY( QgsPointXY( -100, 30 ) ) );

// make a fake render context
QSize size( 640, 480 );
@@ -598,7 +598,7 @@ void TestQgsLabelingEngine::testSubstitutions()
void TestQgsLabelingEngine::testCapitalization()
{
QgsFeature f( vl->fields(), 1 );
f.setGeometry( QgsGeometry::fromPointXY( QgsPointXY( 1, 2 ) ) );
f.setGeometry( QgsGeometry::fromPointXY( QgsPointXY( -100, 30 ) ) );

// make a fake render context
QSize size( 640, 480 );
@@ -663,7 +663,7 @@ void TestQgsLabelingEngine::testCapitalization()
void TestQgsLabelingEngine::testNumberFormat()
{
QgsFeature f( vl->fields(), 1 );
f.setGeometry( QgsGeometry::fromPointXY( QgsPointXY( 1, 2 ) ) );
f.setGeometry( QgsGeometry::fromPointXY( QgsPointXY( -100, 30 ) ) );

// make a fake render context
QSize size( 640, 480 );

0 comments on commit 1144974

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