Skip to content

Commit cc6abef

Browse files
committed
- Fix deletion of connections where port component might be NULL.
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@18980 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent d25c7f5 commit cc6abef

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

OMEdit/OMEditGUI/GUI/Containers/ModelWidgetContainer.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,13 @@ void GraphicsView::deleteComponentObject(Component *pComponent)
490490
int i = 0;
491491
while(i != mConnectionsList.size())
492492
{
493-
if((mConnectionsList[i]->getStartComponent()->getRootParentComponent()->getName() == pComponent->getName()) ||
494-
(mConnectionsList[i]->getEndComponent()->getRootParentComponent()->getName() == pComponent->getName()))
493+
QString startComponentName, endComponentName = "";
494+
if (mConnectionsList[i]->getStartComponent())
495+
startComponentName = mConnectionsList[i]->getStartComponent()->getRootParentComponent()->getName();
496+
if (mConnectionsList[i]->getEndComponent())
497+
endComponentName = mConnectionsList[i]->getEndComponent()->getRootParentComponent()->getName();
498+
499+
if (startComponentName == pComponent->getName() || endComponentName == pComponent->getName())
495500
{
496501
removeConnection(mConnectionsList[i]);
497502
i = 0; //Restart iteration if map has changed
@@ -2359,7 +2364,6 @@ void ModelWidget::getModelConnections(QString className, bool inheritedCycle)
23592364
// get start and end connectors
23602365
Component *pStartConnectorComponent = 0;
23612366
Component *pEndConnectorComponent = 0;
2362-
bool portFound = false;
23632367
bool isExpandableConnector = false;
23642368
if (pStartComponent)
23652369
{
@@ -2389,7 +2393,6 @@ void ModelWidget::getModelConnections(QString className, bool inheritedCycle)
23892393
{
23902394
// if a component type is connector then we only get one item in endComponentList
23912395
// check the endcomponentlist
2392-
portFound = false;
23932396
isExpandableConnector = false;
23942397
pMainWindow->getOMCProxy()->sendCommand("getClassRestriction(" + pEndComponent->getClassName() + ")");
23952398
isExpandableConnector = pMainWindow->getOMCProxy()->getResult().toLower().contains("expandable connector");

0 commit comments

Comments
 (0)