From f2e3ffc776d87ceeb978e9642b7b41045aa5493e Mon Sep 17 00:00:00 2001 From: Marco Bubke <marco.bubke@nokia.com> Date: Wed, 17 Feb 2010 13:35:39 +0100 Subject: [PATCH] Fix crash for a activated state which has no StateGroup --- .../core/instances/qmlstatenodeinstance.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/plugins/qmldesigner/core/instances/qmlstatenodeinstance.cpp b/src/plugins/qmldesigner/core/instances/qmlstatenodeinstance.cpp index cfd973bb669..67eabc4a0fd 100644 --- a/src/plugins/qmldesigner/core/instances/qmlstatenodeinstance.cpp +++ b/src/plugins/qmldesigner/core/instances/qmlstatenodeinstance.cpp @@ -64,14 +64,18 @@ QmlStateNodeInstance::Pointer void QmlStateNodeInstance::activateState() { - if (!isStateActive()) - stateGroup()->setState(property("name").toString()); + if (stateGroup()) { + if (!isStateActive()) + stateGroup()->setState(property("name").toString()); + } } void QmlStateNodeInstance::deactivateState() { - if (isStateActive()) - stateGroup()->setState(QString()); + if (stateGroup()) { + if (isStateActive()) + stateGroup()->setState(QString()); + } } void QmlStateNodeInstance::refreshState() @@ -96,6 +100,8 @@ QmlStateGroup *QmlStateNodeInstance::stateGroup() const bool QmlStateNodeInstance::isStateActive() const { + Q_ASSERT(stateObject()); + Q_ASSERT(stateGroup()); return (stateGroup()->state() == property("name")); } -- GitLab