Commit 713fe83d authored by Ralf Habacker's avatar Ralf Habacker
Browse files

Fix another 'Crash while importing C++ code from existing project'.

Exclude non UMLPackage based uml objects from accessing not present
m_objects member in Model_Utils::findUMLObject().

A common solution would be to solve the dynamic_cast<UMLPackage*>()
failure (see bug) or to add a virtual bool canHaveObjects() method
to UMLObject, which returns false by default and true for classes
derived from UMLPackage to guard the access to m_objects.

parent 6de2d930
...@@ -199,6 +199,18 @@ UMLObject* findUMLObject(const UMLObjectList& inList, ...@@ -199,6 +199,18 @@ UMLObject* findUMLObject(const UMLObjectList& inList,
break; break;
} }
seenPkgs.append(pkg); seenPkgs.append(pkg);
// exclude non package type
// dynamic_cast<UMLPackage*>(pg) fails for unknown reason
// see
UMLObject::ObjectType foundType = pkg->baseType();
if (foundType != UMLObject::ot_Package &&
foundType != UMLObject::ot_Folder &&
foundType != UMLObject::ot_Class &&
foundType != UMLObject::ot_Interface &&
foundType != UMLObject::ot_Component) {
UMLObjectList objectsInCurrentScope = pkg->containedObjects(); UMLObjectList objectsInCurrentScope = pkg->containedObjects();
for (UMLObjectListIt oit(objectsInCurrentScope); oit.hasNext();) { for (UMLObjectListIt oit(objectsInCurrentScope); oit.hasNext();) {
UMLObject *obj =; UMLObject *obj =;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment