fix build mqtt path

This commit is contained in:
technyon
2023-06-07 17:40:07 +02:00
parent cc741ae01e
commit f23290dea6
2 changed files with 4 additions and 2 deletions

View File

@@ -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;
@@ -537,6 +538,7 @@ void Network::buildMqttPath(char* outPath, std::initializer_list<const char*> pa
++offset;
++i;
}
++pathCount;
}
outPath[offset] = 0x00;