summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2011-01-27 08:43:01 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2011-01-27 08:46:20 (GMT)
commiteb55d07febf858474d8755e31cb554a4b8fabcdc (patch)
treea1b5bf4f51ed31fc92373698c7f1924b6d0ca4cc /src
parent4f124cd0177aa79d17361c3d79669730b6d97adc (diff)
downloadQt-eb55d07febf858474d8755e31cb554a4b8fabcdc.zip
Qt-eb55d07febf858474d8755e31cb554a4b8fabcdc.tar.gz
Qt-eb55d07febf858474d8755e31cb554a4b8fabcdc.tar.bz2
Don't crash when appending a null item
Task-number: QTBUG-16871
Diffstat (limited to 'src')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 52e4d79..f463887 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -7689,11 +7689,13 @@ void QGraphicsObject::updateMicroFocus()
void QGraphicsItemPrivate::children_append(QDeclarativeListProperty<QGraphicsObject> *list, QGraphicsObject *item)
{
- QGraphicsObject *graphicsObject = static_cast<QGraphicsObject *>(list->object);
- if (QGraphicsItemPrivate::get(graphicsObject)->sendParentChangeNotification) {
- item->setParentItem(graphicsObject);
- } else {
- QGraphicsItemPrivate::get(item)->setParentItemHelper(graphicsObject, 0, 0);
+ if (item) {
+ QGraphicsObject *graphicsObject = static_cast<QGraphicsObject *>(list->object);
+ if (QGraphicsItemPrivate::get(graphicsObject)->sendParentChangeNotification) {
+ item->setParentItem(graphicsObject);
+ } else {
+ QGraphicsItemPrivate::get(item)->setParentItemHelper(graphicsObject, 0, 0);
+ }
}
}