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 9, 2021
1 parent 8f0a8dd commit 8943ac7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/core/labeling/qgspallabeling.cpp
Expand Up @@ -2429,8 +2429,11 @@ void QgsPalLayerSettings::registerFeature( const QgsFeature &f, QgsRenderContext
if ( QgsPalLabeling::geometryRequiresPreparation( ddPoint, context, ct ) ) if ( QgsPalLabeling::geometryRequiresPreparation( ddPoint, context, ct ) )
{ {
ddPoint = QgsPalLabeling::prepareGeometry( ddPoint, context, ct ); ddPoint = QgsPalLabeling::prepareGeometry( ddPoint, context, ct );
xPos = static_cast< const QgsPoint * >( ddPoint.constGet() )->x(); if ( const QgsPoint *point = qgsgeometry_cast< const QgsPoint * >( ddPoint.constGet() ) )
yPos = static_cast< const QgsPoint * >( ddPoint.constGet() )->y(); {
xPos = point->x();
yPos = point->y();
}
} }


anchorPosition = QgsPointXY( xPos, yPos ); anchorPosition = QgsPointXY( xPos, yPos );
Expand Down

0 comments on commit 8943ac7

Please sign in to comment.