Check defaultActionsCfg is valid

Commit 752626ad550552232d73d8b009db62b0f8e86113 left a code path through
the switch statement where defaultActionsCfg would be an invalid group.

This is semantically correct as there is no relevant actions config for
this type of containment, however we then call methods on it which leads
to an assert in kconfig - and a failing unit test.

REVIEW: 129096
This commit is contained in:
David Edmundson 2016-10-04 16:15:08 +01:00
parent 89a3e34bd2
commit 0f2bc677b9

View File

@ -213,10 +213,11 @@ void Containment::restore(KConfigGroup &group)
//for any other type of containment, there are no defaults
break;
}
defaultActionsCfg = KConfigGroup(&defaultActionsCfg, "ContainmentActions");
foreach (const QString &key, defaultActionsCfg.keyList()) {
setContainmentActions(key, defaultActionsCfg.readEntry(key, QString()));
if (defaultActionsCfg.isValid()) {
defaultActionsCfg = KConfigGroup(&defaultActionsCfg, "ContainmentActions");
foreach (const QString &key, defaultActionsCfg.keyList()) {
setContainmentActions(key, defaultActionsCfg.readEntry(key, QString()));
}
}
}
}