Skip to content
Snippets Groups Projects
Commit f2e3ffc7 authored by Marco Bubke's avatar Marco Bubke
Browse files

Fix crash for a activated state which has no StateGroup

parent b031b206
No related branches found
No related tags found
No related merge requests found
...@@ -64,14 +64,18 @@ QmlStateNodeInstance::Pointer ...@@ -64,14 +64,18 @@ QmlStateNodeInstance::Pointer
void QmlStateNodeInstance::activateState() void QmlStateNodeInstance::activateState()
{ {
if (!isStateActive()) if (stateGroup()) {
stateGroup()->setState(property("name").toString()); if (!isStateActive())
stateGroup()->setState(property("name").toString());
}
} }
void QmlStateNodeInstance::deactivateState() void QmlStateNodeInstance::deactivateState()
{ {
if (isStateActive()) if (stateGroup()) {
stateGroup()->setState(QString()); if (isStateActive())
stateGroup()->setState(QString());
}
} }
void QmlStateNodeInstance::refreshState() void QmlStateNodeInstance::refreshState()
...@@ -96,6 +100,8 @@ QmlStateGroup *QmlStateNodeInstance::stateGroup() const ...@@ -96,6 +100,8 @@ QmlStateGroup *QmlStateNodeInstance::stateGroup() const
bool QmlStateNodeInstance::isStateActive() const bool QmlStateNodeInstance::isStateActive() const
{ {
Q_ASSERT(stateObject());
Q_ASSERT(stateGroup());
return (stateGroup()->state() == property("name")); return (stateGroup()->state() == property("name"));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment