Check the OSD path before trying to load it, Plasma crashes if empty

Review-by: David Edmundson
This commit is contained in:
Martin Klapetek 2014-02-19 14:39:21 +01:00
parent d3d7a6fd63
commit bd0ccdebf7

View File

@ -34,9 +34,14 @@
Osd::Osd(ShellCorona *corona)
: QObject(corona)
{
m_osdObject = new KDeclarative::QmlObject(this);
const QString osdPath = corona->lookAndFeelPackage().filePath("osdmainscript");
if (osdPath.isEmpty()) {
qWarning() << "Failed to load the OSD script file from" << osdPath;
return;
}
m_osdObject->setSource(QUrl::fromLocalFile(corona->lookAndFeelPackage().filePath("osdmainscript")));
m_osdObject = new KDeclarative::QmlObject(this);
m_osdObject->setSource(QUrl::fromLocalFile(osdPath));
m_timeout = m_osdObject->rootObject()->property("timeout").toInt();
QDBusConnection::sessionBus().registerObject("/org/kde/osdService", this, QDBusConnection::ExportAllSlots);