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

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.

BUG:341709
parent 6de2d930
......@@ -199,6 +199,18 @@ UMLObject* findUMLObject(const UMLObjectList& inList,
break;
}
seenPkgs.append(pkg);
// exclude non package type
// dynamic_cast<UMLPackage*>(pg) fails for unknown reason
// see https://bugs.kde.org/show_bug.cgi?id=341709
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) {
continue;
}
UMLObjectList objectsInCurrentScope = pkg->containedObjects();
for (UMLObjectListIt oit(objectsInCurrentScope); oit.hasNext();) {
UMLObject *obj = oit.next();
......
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