diff --git a/source/ArmarXGui/gui-plugins/StatechartViewerPlugin/model/State.cpp b/source/ArmarXGui/gui-plugins/StatechartViewerPlugin/model/State.cpp index 96cc953175938c64709ca8f38e7c1e3035305daf..601e88c1948d0357b29d02f6eefeeaddf99682ff 100644 --- a/source/ArmarXGui/gui-plugins/StatechartViewerPlugin/model/State.cpp +++ b/source/ArmarXGui/gui-plugins/StatechartViewerPlugin/model/State.cpp @@ -375,6 +375,10 @@ StateInstancePtr statechartmodel::State::addSubstate(StateInstancePtr stateInsta { return StateInstancePtr(); } + if (stateInstance->getStateClass() && !checkSubstate(stateInstance->getStateClass())) + { + return StateInstancePtr(); + } substates.insert(stateInstance->getInstanceName(), stateInstance); @@ -545,6 +549,10 @@ StateInstancePtr statechartmodel::State::replaceSubstate(QString stateInstanceNa if (it != substates.end()) { // TODO: This should also try to keep all transitions + if (newInstance->getStateClass() && !checkSubstate(newInstance->getStateClass())) + { + return StateInstancePtr(); + } removeSubstate(stateInstanceName); newInstance->setPosition(it.value()->getTopLeft()); return addSubstate(newInstance); @@ -1070,10 +1078,11 @@ bool statechartmodel::State::checkSubstate(StatePtr newState) const { return false; } - return true; } + + TransitionPtr statechartmodel::State::findTransition(TransitionCPtr t) const { for (int i = 0 ; i < transitions.size(); i++)