ContainmentView: Do not crash on an invalid corona metadata

On launching `plasmashell -wap notExistingName`, it's better to give a
warning instead of crashing.
This commit is contained in:
Vishesh Handa 2015-06-19 00:03:20 +02:00
parent 9976edcbc9
commit c77377221b

View File

@ -192,8 +192,14 @@ ContainmentView::ContainmentView(Plasma::Corona *corona, QWindow *parent)
KDeclarative::KDeclarative kdeclarative;
kdeclarative.setDeclarativeEngine(engine());
//binds things like kconfig and icons
kdeclarative.setTranslationDomain("plasma_shell_" + corona->package().metadata().pluginName());
kdeclarative.setupBindings();
KPluginInfo info = corona->package().metadata();
if (info.isValid()) {
kdeclarative.setTranslationDomain("plasma_shell_" + info.pluginName());
kdeclarative.setupBindings();
} else {
qWarning() << "Invalid corona package metadata";
}
} else {
qWarning() << "Invalid home screen package";
}