Skip to content

Commit

Permalink
Fix crash in labeling if label has data defined x/y set and projectio…
Browse files Browse the repository at this point in the history
…n error occurs transforming these coordinates
  • Loading branch information
nyalldawson committed Jun 14, 2021
1 parent c82678d commit 4a50d87
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/core/labeling/qgspallabeling.cpp
Expand Up @@ -2379,8 +2379,11 @@ void QgsPalLayerSettings::registerFeature( const QgsFeature &f, QgsRenderContext
if ( QgsPalLabeling::geometryRequiresPreparation( ddPoint, context, ct ) )
{
ddPoint = QgsPalLabeling::prepareGeometry( ddPoint, context, ct );
xPos = static_cast< const QgsPoint * >( ddPoint.constGet() )->x();
yPos = static_cast< const QgsPoint * >( ddPoint.constGet() )->y();
if ( const QgsPoint *point = qgsgeometry_cast< const QgsPoint * >( ddPoint.constGet() ) )
{
xPos = point->x();
yPos = point->y();
}
}

anchorPosition = QgsPointXY( xPos, yPos );
Expand Down

0 comments on commit 4a50d87

Please sign in to comment.