Commit 042761bd authored by David Edmundson's avatar David Edmundson Committed by Nate Graham
Browse files

[kcms/lookandfeel] Guard reading invalid first entry

removeItemFromModel calls entry.uninstalledFiles().constFirst

In the (re)installation case we don't check if it had uninstalled files.

BUG: 446100


(cherry picked from commit 24c337de)
parent b2134918
......@@ -114,13 +114,16 @@ void KCMLookandFeel::knsEntryChanged(KNSCore::EntryWrapper *wrapper)
}
const KNSCore::EntryInternal entry = wrapper->entry();
auto removeItemFromModel = [&entry, this]() {
if (entry.uninstalledFiles().isEmpty()) {
return;
}
const QString guessedPluginId = QFileInfo(entry.uninstalledFiles().constFirst()).fileName();
const int index = pluginIndex(guessedPluginId);
if (index != -1) {
m_model->removeRows(index, 1);
}
};
if (entry.status() == KNS3::Entry::Deleted && !entry.uninstalledFiles().isEmpty()) {
if (entry.status() == KNS3::Entry::Deleted) {
removeItemFromModel();
} else if (entry.status() == KNS3::Entry::Installed && !entry.installedFiles().isEmpty()) {
if (!entry.uninstalledFiles().isEmpty()) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment