Commit 9144401c authored by Ralf Habacker's avatar Ralf Habacker
Browse files

Fix 'Crash when importing code java'

Do not call name() of deleted UMLObject instance.

FIXED-IN:2.21.3 (KDE Applications 16.12.3)
parent 9373d946
......@@ -603,25 +603,26 @@ void createGeneralization(UMLClassifier *child, const QString &parentName)
* @param ns uml object instance with incorrect class
* @param currentScope parent uml object
* @return newly created UMLEnum instance
* @return newly created UMLEnum instance or zero in case of error
UMLEnum *remapUMLEnum(UMLObject *ns, UMLPackage *currentScope)
if (ns) {
QString comment = ns->doc();
QString name = ns->name();
QString stereotype = ns->stereotype();
Uml::Visibility::Enum visibility = ns->visibility();
UMLApp::app()->document()->removeUMLObject(ns, true);
if (currentScope == 0)
currentScope = UMLApp::app()->document()->rootFolder(Uml::ModelType::Logical);
ns = Object_Factory::createNewUMLObject(UMLObject::ot_Enum, ns->name(), currentScope, false);
ns->setStereotypeCmd(stereotype.isEmpty() ? QLatin1String("enum") : stereotype);
UMLObject *o = Object_Factory::createNewUMLObject(UMLObject::ot_Enum, name, currentScope, false);
o->setStereotypeCmd(stereotype.isEmpty() ? QLatin1String("enum") : stereotype);
// add to parents child list
if (!currentScope->containedObjects().contains(ns))
return ns->asUMLEnum();
if (!currentScope->containedObjects().contains(o))
return o->asUMLEnum();
return 0;
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