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,15 +1204,17 @@ void VLayoutPiece::DrawMiniature(QPainter &painter) const
painter.drawPath(VPlaceLabelItem::LabelShapePath(label.shape));
}
QPainterPath path;
QVector<QPointF> 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);
}
//---------------------------------------------------------------------------------------------------------------------