Skip to content

Commit

Permalink
[reports] Fix crash in designer when no layout selected
Browse files Browse the repository at this point in the history
Fixes #18019
  • Loading branch information
nyalldawson committed Feb 3, 2018
1 parent 872871f commit be6674b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/gui/layout/qgslayoutruler.cpp
Expand Up @@ -339,6 +339,9 @@ void QgsLayoutRuler::drawGuideAtPos( QPainter *painter, QPoint pos )

void QgsLayoutRuler::createTemporaryGuideItem()
{
if ( !mView->currentLayout() )
return;

delete mGuideItem;
mGuideItem = new QGraphicsLineItem();

Expand Down Expand Up @@ -579,6 +582,9 @@ void QgsLayoutRuler::mouseMoveEvent( QMouseEvent *event )
mMarkerPos = event->pos();
update();

if ( !mView->currentLayout() )
return;

QPointF displayPos;
if ( mCreatingGuide || mDraggingGuide )
{
Expand Down Expand Up @@ -678,6 +684,9 @@ void QgsLayoutRuler::mouseMoveEvent( QMouseEvent *event )

void QgsLayoutRuler::mousePressEvent( QMouseEvent *event )
{
if ( !mView->currentLayout() )
return;

if ( event->button() == Qt::LeftButton )
{
mDraggingGuide = guideAtPoint( event->pos() );
Expand Down Expand Up @@ -706,6 +715,9 @@ void QgsLayoutRuler::mousePressEvent( QMouseEvent *event )

void QgsLayoutRuler::mouseReleaseEvent( QMouseEvent *event )
{
if ( mView->currentLayout() )
return;

if ( event->button() == Qt::LeftButton )
{
if ( mDraggingGuide )
Expand Down

0 comments on commit be6674b

Please sign in to comment.