summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Kellogg <[email protected]>2015-03-07 09:42:18 +0100
committerOliver Kellogg <[email protected]>2015-03-07 09:42:18 +0100
commitfd55275d9bf3ad80849d0e8a977b11384de1c877 (patch)
treee9c20b689e21fc01d6fc1a7ea7bbad8730633aa7
parent68bbcd3724244857ed169794b6cd17d9949d07f0 (diff)
Followup to commit 6ec64a7 :
- For robustness, in AssocRules::allowAssociation() check for (assocType == Uml::AssociationType::Containment) do not rely on listItemA and listItemB being returned non NULL from UMLListView::findUMLObject().
-rw-r--r--umbrello/assocrules.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/umbrello/assocrules.cpp b/umbrello/assocrules.cpp
index f589fdb..b849e6c 100644
--- a/umbrello/assocrules.cpp
+++ b/umbrello/assocrules.cpp
@@ -176,13 +176,14 @@ bool AssocRules::allowAssociation(Uml::AssociationType::Enum assocType,
UMLListViewItem* listItemA = UMLApp::app()->listView()->findUMLObject(widgetA->umlObject());
UMLListViewItem* listItemB = UMLApp::app()->listView()->findUMLObject(widgetB->umlObject());
- //Great, we have our listviewitems, now check to make sure that they don't become recursive.
- if(listItemA->parent() == static_cast<QTreeWidgetItem*>(listItemB))
- {
- //The user is trying to make the parent the child and the child the parent. Stop them!
- return false;
+ if (listItemA && listItemB) {
+ // Great, we have our listviewitems, now check to make sure that they don't become recursive.
+ if (listItemA->parent() == static_cast<QTreeWidgetItem*>(listItemB)) {
+ // The user is trying to make the parent the child and the child the parent. Stop them!
+ return false;
+ }
}
- //This was just a little assertion for safety, don't return yet!
+ // This was just a little assertion for safety, don't return yet!
}
AssociationWidgetList list = widgetB->associationWidgetList();