[Uml-devel] branches/work/soc-umbrello/umbrello

Gopala Krishna A krishna.ggk at gmail.com
Mon Jul 13 07:56:54 UTC 2009


SVN commit 995691 by gopala:

Check if UMLWidget for any of AssociationWidget's role is null and if so
do not crash.


 M  +17 -0     newlinepath.cpp  


--- branches/work/soc-umbrello/umbrello/newlinepath.cpp #995690:995691
@@ -951,6 +951,12 @@
         UMLWidget *widA = m_associationWidget->widgetForRole(Uml::A);
         UMLWidget *widB = m_associationWidget->widgetForRole(Uml::B);
 
+        if (!widA || !widB) {
+            uError() << "AssociationWidget is only partially constructed."
+                     << "One or both UMLWidget are null";
+            return RegionPair();
+        }
+
         QRectF aRect = widA->sceneRect();
         QRectF bRect = widB->sceneRect();
 
@@ -993,6 +999,12 @@
         UMLWidget *aWid = m_associationWidget->widgetForRole(Uml::A);
         UMLWidget *bWid = m_associationWidget->widgetForRole(Uml::B);
 
+        if (!aWid || !bWid) {
+            uError() << "AssociationWidget is only partially constructed."
+                     << "One or both UMLWidget are null";
+            return;
+        }
+
         AssociationSpaceManager *aSpaceManager =
             aWid->associationSpaceManager();
         AssociationSpaceManager *bSpaceManager =
@@ -1034,6 +1046,11 @@
                 insertPoint(i, QPointF());
             }
             UMLWidget *wid = m_associationWidget->widgetForRole(Uml::A);
+            if (!wid) {
+                uError() << "AssociationWidget is partially constructed."
+                            "UMLWidget for role A is null.";
+                return;
+            }
             const QRectF rect = m_associationWidget->mapFromScene(
                     wid->sceneRect()).boundingRect();
 




More information about the umbrello-devel mailing list