guard against crash

This commit is contained in:
Marco Martin 2011-06-19 19:07:26 +02:00
parent 25c6e9800a
commit 3475f99f96

View File

@ -133,12 +133,18 @@ void DialogProxy::syncMainItem()
QGraphicsObject *qo = qobject_cast<QGraphicsObject *>(parent);
if (qo) {
scene = qo->scene();
scene->addItem(m_mainItem.data());
break;
if (scene) {
scene->addItem(m_mainItem.data());
break;
}
}
}
}
if (!scene) {
return;
}
//the parent of the qobject never changed, only the parentitem, so put it back what it was
m_mainItem.data()->setParentItem(qobject_cast<QGraphicsObject *>(m_mainItem.data()->parent()));