assert plasma kpart on various "should never happen" cases

This commit is contained in:
Shaun Reich 2012-02-11 11:38:45 -05:00
parent 5e6fc957f2
commit 8526f0a0b6

View File

@ -127,11 +127,13 @@ PlasmaKPartCorona* PlasmaKPart::corona() const
void PlasmaKPart::createView(Plasma::Containment *containment) void PlasmaKPart::createView(Plasma::Containment *containment)
{ {
Q_ASSERT(containment);
m_view->setContainment(containment); m_view->setContainment(containment);
} }
void PlasmaKPart::addApplet(const QString& name, const QVariantList& args, const QRectF& geometry ) void PlasmaKPart::addApplet(const QString& name, const QVariantList& args, const QRectF& geometry )
{ {
Q_ASSERT(containment());
containment()->addApplet(name, args, geometry); containment()->addApplet(name, args, geometry);
} }
@ -155,6 +157,8 @@ void PlasmaKPart::setConfigFile(const QString &file)
Plasma::Containment* PlasmaKPart::containment() const Plasma::Containment* PlasmaKPart::containment() const
{ {
Q_ASSERT(corona());
Q_ASSERT(!corona()->containments().isEmpty());
return corona()->containments().first(); return corona()->containments().first();
} }