Commit 1d3df76a authored by David Jarvie's avatar David Jarvie
Browse files

Fix crash when no file resources exist

parent 274d42e5
......@@ -76,6 +76,11 @@ FileResourceDataModel::FileResourceDataModel(QObject* parent)
, ResourceDataModelBase()
, mHaveEvents(false)
{
qCDebug(KALARM_LOG) << "FileResourceDataModel::FileResourceDataModel";
// Create the vector of resource nodes for the model root.
mResourceNodes[Resource()];
// Get a list of all resources, and their alarms, if they have already been
// created before this, by a previous call to FileResourceConfigManager::createResources().
const QList<ResourceId> resourceIds = FileResourceConfigManager::resourceIds();
......
......@@ -149,7 +149,7 @@ private:
void updateHaveEvents(bool have) { mHaveEvents = have; Q_EMIT haveEventsStatus(have); }
static bool mInstanceIsOurs; // mInstance is a FileResourceDataModel instance
// Resource nodes for model root [Resource = nullptr], and
// Resource nodes for model root [Resource = Resource()], and
// Event nodes for each resource.
QHash<Resource, QVector<Node*>> mResourceNodes;
// Resources in the order in which they are held in the model.
......
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