[Uml-devel] branches/KDE/3.5/kdesdk/umbrello/umbrello/codegenerators

Oliver Kellogg okellogg at users.sourceforge.net
Sun Sep 18 20:41:42 UTC 2005


SVN commit 461902 by okellogg:

updateContent(): Avoid dereferencing a NULL pointer.

 M  +6 -2      cppheadercodeclassfielddeclarationblock.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codegenerators/cppheadercodeclassfielddeclarationblock.cpp #461901:461902
@@ -41,12 +41,16 @@
  */
 void CPPHeaderCodeClassFieldDeclarationBlock::updateContent( )
 {
+    UMLObject *umlparent = CodeClassFieldDeclarationBlock::getParentObject();
+    if (umlparent == NULL) {
+        return;
+    }
 
     CodeClassField * cf = getParentClassField();
     CPPCodeClassField * hcppcf = (CPPCodeClassField*) cf;
 
     // Set the comment
-    QString notes = getParentObject()->getDoc();
+    QString notes = umlparent->getDoc();
     getComment()->setText(notes);
     if(notes.isEmpty())
         getComment()->setWriteOutText(false);
@@ -55,7 +59,7 @@
 
 
     // Set the body
-    QString staticValue = getParentObject()->getStatic() ? "static " : "";
+    QString staticValue = umlparent->getStatic() ? "static " : "";
     QString typeName = hcppcf->getTypeName();
     QString fieldName = hcppcf->getFieldName();
 




More information about the umbrello-devel mailing list