summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2009-10-06 23:31:27 (GMT)
committerBea Lam <bea.lam@nokia.com>2009-10-06 23:31:27 (GMT)
commit681a278c7108c2bd87be6279694875cdb391e3db (patch)
treeb95b54509840f3c1e351854278347c526e33a188
parent3710e8ca85c7f1dddb9dc752a6120523ce6bf781 (diff)
downloadQt-681a278c7108c2bd87be6279694875cdb391e3db.zip
Qt-681a278c7108c2bd87be6279694875cdb391e3db.tar.gz
Qt-681a278c7108c2bd87be6279694875cdb391e3db.tar.bz2
Fix to not crash if item has no parent for some reason.
-rw-r--r--src/declarative/util/qmlstateoperations.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp
index a9a5bd5..921aa6c 100644
--- a/src/declarative/util/qmlstateoperations.cpp
+++ b/src/declarative/util/qmlstateoperations.cpp
@@ -208,9 +208,12 @@ void QmlParentChange::saveOriginals()
d->origParent = d->target->parentItem();
- //try to determine the items original stack position so we can restore it
- if (!d->origParent)
+ if (!d->origParent) {
d->origStackBefore = 0;
+ return;
+ }
+
+ //try to determine the item's original stack position so we can restore it
int siblingIndex = ((AccessibleFxItem*)d->target)->siblingIndex() + 1;
QList<QGraphicsItem*> children = d->origParent->childItems();
for (int i = 0; i < children.count(); ++i) {