From 53f7d00e6d50bc574b6418d833f45f182981c7e6 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 27 Jul 2021 10:13:11 +0300 Subject: [PATCH] Fix crash when a grainline is empty. --- src/libs/vlayout/vlayoutpiece.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index fe93188c4..58f3092ab 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -1204,15 +1204,17 @@ void VLayoutPiece::DrawMiniature(QPainter &painter) const painter.drawPath(VPlaceLabelItem::LabelShapePath(label.shape)); } - QPainterPath path; - QVector gPoints = GetGrainline(); - path.moveTo(gPoints.at(0)); - for (auto p : qAsConst(gPoints)) + if (not gPoints.isEmpty()) { - path.lineTo(p); + QPainterPath path; + path.moveTo(gPoints.at(0)); + for (auto p : qAsConst(gPoints)) + { + path.lineTo(p); + } + painter.drawPath(path); } - painter.drawPath(path); } //---------------------------------------------------------------------------------------------------------------------