[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Tue Jul 27 10:25:02 UTC 2004


CVS commit by okellogg: 

First preparation for fixing bug 71969.


  M +20 -10    umldoc.cpp   1.171


--- kdesdk/umbrello/umbrello/umldoc.cpp  #1.170:1.171
@@ -1559,18 +1559,29 @@ void UMLDoc::removeUMLObject(UMLObject* 
 
         if (objectTypeIsClassifierListItem(type))  {
-
                 UMLClassifier* parent = (UMLClassifier*)umlobject->parent();
+                if (parent == NULL) {
+                        kdError() << "UMLDoc::removeUMLObject: parent of umlobject is NULL"
+                                  << endl;
+                        return;
+                }
                 emit sigObjectRemoved(umlobject);
                 if (type == ot_Operation) {
-                        parent->removeOperation(dynamic_cast<UMLOperation*>(umlobject));
-                } else if (type == ot_Attribute) {
+                        parent->removeOperation(static_cast<UMLOperation*>(umlobject));
+                } else {
                         UMLClass* pClass = dynamic_cast<UMLClass*>(parent);
-                        if (pClass)  {
-                                pClass->removeAttribute(umlobject);
+                        if (pClass == NULL)  {
+                                kdError() << "UMLDoc::removeUMLObject: parent of umlobject has "
+                                          << "unexpected type " << parent->getBaseType() << endl;
+                                return;
                         }
+                        if (type == ot_Attribute) {
+                                pClass->removeAttribute(umlobject);
                 } else if (type == ot_Template) {
-                        UMLClass* pClass = dynamic_cast<UMLClass*>(parent);
-                        if (pClass)  {
-                                pClass->removeTemplate((UMLTemplate*)umlobject);
+                                pClass->removeTemplate(static_cast<UMLTemplate*>(umlobject));
+                        } else if (type == ot_Stereotype) {
+                                pClass->removeStereotype(static_cast<UMLStereotype*>(umlobject));
+                        } else {
+                                kdError() << "UMLDoc::removeUMLObject: umlobject has "
+                                          << "unexpected type " << type << endl;
                         }
                 }






More information about the umbrello-devel mailing list