From 1d5979e532fda697ff729e5052848d0d067070ba Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Thu, 29 May 2008 08:49:40 +0000 Subject: [PATCH] check that we have children; prevents crash. will continue polishing from the fairgrounds later today. svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=814045 --- applet.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/applet.cpp b/applet.cpp index 3e6195425..d1a6f9b5d 100644 --- a/applet.cpp +++ b/applet.cpp @@ -702,9 +702,13 @@ void Applet::flushPendingConstraintsEvents() if (c & Plasma::SizeConstraint && d->needsConfigOverlay) { d->needsConfigOverlay->setGeometry(QRectF(QPointF(0, 0), boundingRect().size())); - // FIXME:: rather horrible hack to work around the fact we don't have spacers - // for layouts, and with WoC coming i'd rather not expend effort there - QGraphicsItem * button = d->needsConfigOverlay->QGraphicsItem::children().first(); + QGraphicsItem *button = 0; + QList children = d->needsConfigOverlay->QGraphicsItem::children(); + + if (!children.isEmpty()) { + button = children.first(); + } + if (button) { QSizeF s = button->boundingRect().size(); button->setPos(d->needsConfigOverlay->boundingRect().width() / 2 - s.width() / 2,