From f23290dea677daee1091f20146eb818238b70114 Mon Sep 17 00:00:00 2001 From: technyon Date: Wed, 7 Jun 2023 17:40:07 +0200 Subject: [PATCH] fix build mqtt path --- Config.h | 2 +- Network.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Config.h b/Config.h index 4a26369..d7b7e8a 100644 --- a/Config.h +++ b/Config.h @@ -1,6 +1,6 @@ #pragma once -#define NUKI_HUB_VERSION "8.24-pre-1" +#define NUKI_HUB_VERSION "8.24-pre-3" #define MQTT_QOS_LEVEL 1 #define MQTT_CLEAN_SESSIONS false diff --git a/Network.cpp b/Network.cpp index 85598d1..0e4cbbe 100644 --- a/Network.cpp +++ b/Network.cpp @@ -521,10 +521,11 @@ void Network::initTopic(const char *prefix, const char *path, const char *value) void Network::buildMqttPath(char* outPath, std::initializer_list paths) { int offset = 0; + int pathCount = 0; for(const char* path : paths) { - if(path[0] != '/') + if(pathCount > 0 && path[0] != '/') { outPath[offset] = '/'; ++offset; @@ -537,6 +538,7 @@ void Network::buildMqttPath(char* outPath, std::initializer_list pa ++offset; ++i; } + ++pathCount; } outPath[offset] = 0x00;