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

Oliver Kellogg okellogg at users.sourceforge.net
Thu Jan 13 08:18:10 UTC 2005


CVS commit by okellogg: 

parseTemplateDeclaration(): Check pointers for NULL before dereferencing.


  M +19 -9     cpptree2uml.cpp   1.19


--- kdesdk/umbrello/umbrello/classparser/cpptree2uml.cpp  #1.18:1.19
@@ -180,7 +180,12 @@ void CppTree2Uml::parseTemplateDeclarati
         if (typeParmNode) {
             NameAST* nameNode = typeParmNode->name();
+            if (nameNode) {
             QString typeName = nameNode->unqualifiedName()->text();
             Umbrello::NameAndType nt(typeName, NULL);
             m_templateParams.append(nt);
+            } else {
+                kdError() << "CppTree2Uml::parseTemplateDeclaration(type):"
+                          << " nameNode is NULL" << endl;
+            }
         }
 
@@ -189,7 +194,7 @@ void CppTree2Uml::parseTemplateDeclarati
             TypeSpecifierAST* typeSpec = valueNode->typeSpec();
             if (typeSpec == NULL) {
-                kdError() << "CppTree2Uml::parseTemplateDeclaration: typeSpec is NULL"
-                          << endl;
-                break;
+                kdError() << "CppTree2Uml::parseTemplateDeclaration(value):"
+                          << " typeSpec is NULL" << endl;
+                continue;
             }
             QString typeName = typeSpec->name()->text();
@@ -198,4 +203,9 @@ void CppTree2Uml::parseTemplateDeclarati
             DeclaratorAST* declNode = valueNode->declarator();
             NameAST* nameNode = declNode->declaratorId();
+            if (nameNode == NULL) {
+                kdError() << "CppTree2Uml::parseTemplateDeclaration(value):"
+                          << " nameNode is NULL" << endl;
+                continue;
+            }
             QString paramName = nameNode->unqualifiedName()->text();
             Umbrello::NameAndType nt(paramName, t);






More information about the umbrello-devel mailing list