Skip to content

Commit

Permalink
Don't try to label empty geometries
Browse files Browse the repository at this point in the history
Fixes #33931
  • Loading branch information
nyalldawson authored and m-kuhn committed Jan 22, 2020
1 parent ce2f3f9 commit 1144974
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/core/labeling/qgspallabeling.cpp
Expand Up @@ -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 );
Expand Down Expand Up @@ -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();
}
Expand Down
6 changes: 3 additions & 3 deletions tests/src/core/testqgslabelingengine.cpp
Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
Expand Down

0 comments on commit 1144974

Please sign in to comment.