I don't know why you would want to read from an invalid group, but wouldn't it make the patch a lot easier if you just returned the default right away if the group is invalid? i.e. replace Q_ASSERT(isValid()); with if (!isValid()) { return aDefault; }