From 681a278c7108c2bd87be6279694875cdb391e3db Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Wed, 7 Oct 2009 09:31:27 +1000 Subject: Fix to not crash if item has no parent for some reason. --- src/declarative/util/qmlstateoperations.cpp | 7 +++++-- 1 file 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 children = d->origParent->childItems(); for (int i = 0; i < children.count(); ++i) { -- cgit v0.12