[Uml-devel] kdesdk/umbrello/umbrello/codegenerators

Oliver Kellogg okellogg at users.sourceforge.net
Thu Dec 16 15:09:04 UTC 2004


CVS commit by okellogg: 

getInitialValue(): Make sure parent is truly a UMLAttribute.


  M +8 -2      cppcodeclassfield.cpp   1.7


--- kdesdk/umbrello/umbrello/codegenerators/cppcodeclassfield.cpp  #1.6:1.7
@@ -80,6 +80,12 @@ QString CPPCodeClassField::getInitialVal
         if (parentIsAttribute()) 
         {
-                UMLAttribute * at = (UMLAttribute*) getParentObject();
+                UMLAttribute * at = dynamic_cast<UMLAttribute*>( getParentObject() );
+                if (at) {
                 return fixInitialStringDeclValue(at->getInitialValue(), getTypeName());
+                } else {
+                        kdError() << "CPPCodeClassField::getInitialValue: parent object is not a UMLAttribute"
+                                  << endl;
+                        return "";
+                }
         } 
         else 






More information about the umbrello-devel mailing list