Commit 3d6e5fff authored by Jochen Becher's avatar Jochen Becher

ModelEditor: Avoid crash if an illegal relation is placed on a diagram.

Change-Id: I0e62f4665c8530095d1beedc2c263d6212aa53e7
Reviewed-by: Tobias Hunger's avatarTobias Hunger <tobias.hunger@qt.io>
parent 9b9215af
......@@ -62,10 +62,12 @@ void AssociationItem::update(const Style *style)
QMT_CHECK(m_arrow);
QGraphicsItem *endAItem = m_diagramSceneModel->graphicsItem(m_association->endAUid());
QMT_CHECK(endAItem);
if (!endAItem)
return;
placeEndLabels(m_arrow->firstLineSegment(), m_endAName, m_endACardinality, endAItem, m_arrow->startHeadLength());
QGraphicsItem *endBItem = m_diagramSceneModel->graphicsItem(m_association->endBUid());
QMT_CHECK(endBItem);
if (!endBItem)
return;
placeEndLabels(m_arrow->lastLineSegment(), m_endBName, m_endBCardinality, endBItem, m_arrow->endHeadLength());
}
......
......@@ -492,7 +492,8 @@ QPointF RelationItem::calcEndPoint(const Uid &end, const Uid &otherEnd, int near
QPointF RelationItem::calcEndPoint(const Uid &end, const QPointF &otherEndPos, int nearestIntermediatePointIndex)
{
QGraphicsItem *endItem = m_diagramSceneModel->graphicsItem(end);
QMT_CHECK(endItem);
if (!endItem)
return QPointF(0, 0);
auto endObjectItem = dynamic_cast<IIntersectionable *>(endItem);
QPointF endPos;
if (endObjectItem) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment