From ad238ed31569da1fd7e012892f0438de293b15dc Mon Sep 17 00:00:00 2001
From: Thomas Hartmann <Thomas.Hartmann@nokia.com>
Date: Fri, 15 Jul 2011 13:30:49 +0200
Subject: [PATCH] QmlDesigner: crash fix

If the root node is invalid currentState is also invalid.

Change-Id: Icf47c9295cdf82bf7b36328e76dbb1a974ee43f9
Reviewed-on: http://codereview.qt.nokia.com/1706
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
---
 .../qmldesigner/components/stateseditor/stateseditorview.cpp    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp
index 277eb33189c..968602bafaa 100644
--- a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp
+++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp
@@ -264,7 +264,7 @@ void StatesEditorView::nodeAboutToBeRemoved(const ModelNode &removedNode)
             m_lastIndex = propertyParent.indexOf(removedNode);
         }
     }
-    if (removedNode == currentState())
+    if (currentState().isValid() && removedNode == currentState())
         setCurrentState(baseState());
 }
 
-- 
GitLab