Commit e4367ef6 authored by Gus Grubba's avatar Gus Grubba

CP - If a metadata name is not found in the Json file, issue an error and...

CP - If a metadata name is not found in the Json file, issue an error and exit. It would crash if let proceed.
parent 605c285e
......@@ -11,19 +11,24 @@
#include "QGCCorePlugin.h"
#include "QGCApplication.h"
static const char* kJsonFile = ":/json/%1.SettingsGroup.json";
SettingsGroup::SettingsGroup(const QString& name, const QString& settingsGroup, QObject* parent)
: QObject (parent)
, _visible (qgcApp()->toolbox()->corePlugin()->overrideSettingsGroupVisibility(name))
, _name (name)
, _settingsGroup(settingsGroup)
, _visible (qgcApp()->toolbox()->corePlugin()->overrideSettingsGroupVisibility(_name))
{
QString jsonNameFormat(":/json/%1.SettingsGroup.json");
_nameToMetaDataMap = FactMetaData::createMapFromJsonFile(jsonNameFormat.arg(_name), this);
_nameToMetaDataMap = FactMetaData::createMapFromJsonFile(QString(kJsonFile).arg(name), this);
}
SettingsFact* SettingsGroup::_createSettingsFact(const QString& factName)
{
return new SettingsFact(_settingsGroup, _nameToMetaDataMap[factName], this);
FactMetaData* m = _nameToMetaDataMap[factName];
if(!m) {
qCritical() << "Fact name " << factName << "not found in" << QString(kJsonFile).arg(_name);
exit(-1);
}
return new SettingsFact(_settingsGroup, m, this);
}
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