Skip to content

Commit

Permalink
Fix possible crash when rendering callouts (master only)
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Mar 18, 2021
1 parent 6909b45 commit cfde40d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core/callouts/qgscallout.cpp
Expand Up @@ -652,6 +652,9 @@ void QgsSimpleLineCallout::draw( QgsRenderContext &context, QRectF rect, const d

const QPolygonF points = line.asQPolygonF();

if ( points.empty() )
return;

QgsCalloutPosition position;
position.setOrigin( context.mapToPixel().toMapCoordinates( points.at( 0 ).x(), points.at( 0 ).y() ).toQPointF() );
position.setDestination( context.mapToPixel().toMapCoordinates( points.constLast().x(), points.constLast().y() ).toQPointF() );
Expand Down Expand Up @@ -771,6 +774,9 @@ void QgsManhattanLineCallout::draw( QgsRenderContext &context, QRectF rect, cons

const QPolygonF points = line.asQPolygonF();

if ( points.empty() )
return;

QgsCalloutPosition position;
position.setOrigin( context.mapToPixel().toMapCoordinates( points.at( 0 ).x(), points.at( 0 ).y() ).toQPointF() );
position.setDestination( context.mapToPixel().toMapCoordinates( points.constLast().x(), points.constLast().y() ).toQPointF() );
Expand Down

0 comments on commit cfde40d

Please sign in to comment.