diff --git a/src/plugins/qmldesigner/core/instances/qmlstatenodeinstance.cpp b/src/plugins/qmldesigner/core/instances/qmlstatenodeinstance.cpp
index cfd973bb6696081a68417d029282e8c3210305c6..67eabc4a0fd8fc80d9ceb6aeecd9814e1d3c18d6 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"));
 }