From 75e2479a9cc9c64827dfe5468b69e71e1e264125 Mon Sep 17 00:00:00 2001 From: Alex Hultman Date: Sat, 10 Apr 2021 23:16:04 +0200 Subject: [PATCH] Do not append / to root-level topicNames --- src/TopicTree.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/TopicTree.h b/src/TopicTree.h index a404ba5..7ea06f0 100644 --- a/src/TopicTree.h +++ b/src/TopicTree.h @@ -339,8 +339,13 @@ public: /* Set fullname as parent's name plus our name */ newTopic->fullName.reserve(newTopic->parent->fullName.length() + 1 + segment.length()); - newTopic->fullName.append(newTopic->parent->fullName); - newTopic->fullName.append("/"); + + /* Only append parent's name if parent is not root */ + if (newTopic->parent != root) { + newTopic->fullName.append(newTopic->parent->fullName); + newTopic->fullName.append("/"); + } + newTopic->fullName.append(segment); /* For simplicity we do insert wildcards with text */