forked from qt-creator/qt-creator
ModelEditor: Avoid crash if an illegal relation is placed on a diagram.
Change-Id: I0e62f4665c8530095d1beedc2c263d6212aa53e7 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user