Skip to content

Commit

Permalink
fix build mqtt path
Browse files Browse the repository at this point in the history
  • Loading branch information
technyon committed Jun 7, 2023
1 parent cc741ae commit f23290d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Config.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 3 additions & 1 deletion Network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,10 +521,11 @@ void Network::initTopic(const char *prefix, const char *path, const char *value)
void Network::buildMqttPath(char* outPath, std::initializer_list<const char*> paths)
{
int offset = 0;
int pathCount = 0;

for(const char* path : paths)
{
if(path[0] != '/')
if(pathCount > 0 && path[0] != '/')
{
outPath[offset] = '/';
++offset;
Expand All @@ -537,6 +538,7 @@ void Network::buildMqttPath(char* outPath, std::initializer_list<const char*> pa
++offset;
++i;
}
++pathCount;
}

outPath[offset] = 0x00;
Expand Down

0 comments on commit f23290d

Please sign in to comment.