mainitem can be null according to the if() below, so respect that

This commit is contained in:
Aaron Seigo 2011-07-13 13:14:40 +02:00
parent dd95295cb0
commit 201baafc1c

View File

@ -106,9 +106,11 @@ void DialogProxy::setMainItem(QGraphicsObject *mainItem)
{ {
if (m_mainItem.data() != mainItem) { if (m_mainItem.data() != mainItem) {
if (m_mainItem) { if (m_mainItem) {
m_mainItem.data()->setParent(mainItem->parent()); m_mainItem.data()->setParent(mainItem ? mainItem->parent() : 0);
} }
m_mainItem = mainItem; m_mainItem = mainItem;
if (mainItem) { if (mainItem) {
mainItem->setParentItem(0); mainItem->setParentItem(0);
mainItem->setParent(this); mainItem->setParent(this);