Commit 7c46d893 authored by Arjen Hiemstra's avatar Arjen Hiemstra
Browse files

Don't emit dataChanged for invalid indices

getQModelIndex can return an invalid index. If that happens, we emit
dataChanged for an invalid index, which is incorrect and may cause
errors in other models.

CCBUG: 431155


(cherry picked from commit 9807db5c)
parent 4d6ef161
......@@ -215,7 +215,9 @@ void ProcessDataModel::setEnabledAttributes(const QStringList &enabledAttributes
connect(attribute, &KSysGuard::ProcessAttribute::dataChanged, this, [this, columnIndex](KSysGuard::Process *process) {
if (process->pid() != -1) {
const QModelIndex index = d->getQModelIndex(process, columnIndex);
emit dataChanged(index, index);
if (index.isValid()) {
emit dataChanged(index, index);
}
}
});
......
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