The name of the initial branch for new projects is now "main" instead of "master". Existing projects remain unchanged. More information: https://doku.lrz.de/display/PUBLIC/GitLab

Commit db1fb0ce authored by Michael Ott's avatar Michael Ott
Browse files

Check for valid entity pointer in constructSensorTopics()

parent a3f7e7a8
......@@ -465,11 +465,14 @@ class ConfiguratorTemplateEntity : public ConfiguratorTemplate<SBase, SGroup> {
// Sensor names are adjusted according to the respective MQTT topics
for (auto &g : _sensorGroups) {
for (auto &s : g->acquireSensors()) {
s->setMqtt(MQTTChecker::formatTopic(_mqttPrefix) +
MQTTChecker::formatTopic(g->getEntity()->getMqttPart()) +
MQTTChecker::formatTopic(g->getMqttPart()) +
MQTTChecker::formatTopic(s->getMqtt()));
s->setName(s->getMqtt());
std::string mqtt = MQTTChecker::formatTopic(_mqttPrefix);
if (g->getEntity()) {
mqtt.append(MQTTChecker::formatTopic(g->getEntity()->getMqttPart()));
}
mqtt.append(MQTTChecker::formatTopic(g->getMqttPart()));
mqtt.append(MQTTChecker::formatTopic(s->getMqtt()));
s->setMqtt(mqtt);
s->setName(mqtt);
SensorMetadata *sm = s->getMetadata();
if (sm) {
sm->setPublicName(s->getMqtt());
......
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