From cc97bd82975e75dc71602f74ff657572a85f2eae Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 26 May 2015 15:44:41 +0200 Subject: [PATCH] most entries are not kcms, fail gracefully don't spit scary errors when an entry has an empty plugin path, ie not a kcm Change-Id: I1f2cc744aaed315ae3dd56d5a55082eb09a5ed6e --- src/plasmaquick/configmodel.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plasmaquick/configmodel.cpp b/src/plasmaquick/configmodel.cpp index 07526ccbe..c452bb4cc 100644 --- a/src/plasmaquick/configmodel.cpp +++ b/src/plasmaquick/configmodel.cpp @@ -210,11 +210,17 @@ QVariant ConfigModel::data(const QModelIndex &index, int role) const return d->categories.at(index.row())->visible(); case KCMRole: { const QString pluginName = d->categories.at(index.row())->pluginName(); + const QString pluginPath = KPluginLoader::findPlugin(pluginName); + //no kcm is registered for this row, it's a normal qml-only entry + if (pluginName.isEmpty() || pluginPath.isEmpty()) { + return QVariant(); + } + if (d->kcms.contains(pluginName)) { return QVariant::fromValue(d->kcms.value(pluginName)); } - KPluginLoader loader(KPluginLoader::findPlugin(pluginName)); + KPluginLoader loader(pluginPath); KPluginFactory* factory = loader.factory(); if (!factory) { qWarning() << "Error loading KCM:" << loader.errorString();