diff --git a/applethandle.cpp b/applethandle.cpp index ba7b054f8..56f858ee3 100644 --- a/applethandle.cpp +++ b/applethandle.cpp @@ -408,16 +408,18 @@ void AppletHandle::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) QList containments = corona->containments(); for (int i = 0; i < containments.size(); ++i) { QPointF pos; - pos = containments[i]->view()->mapToScene(containments[i]->view() - ->mapFromGlobal(m_screenRect.topLeft())); + if (containments[i]->view()) { + pos = containments[i]->view()->mapToScene(containments[i]->view() + ->mapFromGlobal(m_screenRect.topLeft())); - if (containments[i]->sceneBoundingRect().contains(pos)) { - //kDebug() << "new containment = " << containments[i]; - kDebug() << "rect = " << containments[i]->sceneBoundingRect(); - // add the applet to the new containment and take it from the old one - kDebug() << "moving to other containment with position" << pos;; - switchContainment(containments[i], pos); - break; + if (containments[i]->sceneBoundingRect().contains(pos)) { + //kDebug() << "new containment = " << containments[i]; + kDebug() << "rect = " << containments[i]->sceneBoundingRect(); + // add the applet to the new containment and take it from the old one + kDebug() << "moving to other containment with position" << pos;; + switchContainment(containments[i], pos); + break; + } } } }