Fix crash when a grainline is empty.

This commit is contained in:
Roman Telezhynskyi 2021-07-27 10:13:11 +03:00
parent bbc6f20237
commit 53f7d00e6d

View File

@ -1204,9 +1204,10 @@ void VLayoutPiece::DrawMiniature(QPainter &painter) const
painter.drawPath(VPlaceLabelItem::LabelShapePath(label.shape)); painter.drawPath(VPlaceLabelItem::LabelShapePath(label.shape));
} }
QPainterPath path;
QVector<QPointF> gPoints = GetGrainline(); QVector<QPointF> gPoints = GetGrainline();
if (not gPoints.isEmpty())
{
QPainterPath path;
path.moveTo(gPoints.at(0)); path.moveTo(gPoints.at(0));
for (auto p : qAsConst(gPoints)) for (auto p : qAsConst(gPoints))
{ {
@ -1214,6 +1215,7 @@ void VLayoutPiece::DrawMiniature(QPainter &painter) const
} }
painter.drawPath(path); painter.drawPath(path);
} }
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QGraphicsItem *VLayoutPiece::GetItem(bool textAsPaths) const QGraphicsItem *VLayoutPiece::GetItem(bool textAsPaths) const