From 031894a63e5a9f87f71c708b92db68152896424c Mon Sep 17 00:00:00 2001 From: Patrick Balsiger Date: Mon, 19 Nov 2018 22:57:21 +0100 Subject: [PATCH] fix topic comparison --- src/MqttPlugin.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/MqttPlugin.cpp b/src/MqttPlugin.cpp index 0914337..bf81f5d 100644 --- a/src/MqttPlugin.cpp +++ b/src/MqttPlugin.cpp @@ -98,9 +98,9 @@ void MqttPlugin::downstreamHandler(char *topic, uint8_t *payload, unsigned int l String topicStr = String(topic); int topicRootLength = topicRoot.length(); if(topicStr.length() > topicRootLength){ - int baseTopicLength = topicStr.substring(0, topicRootLength).length(); - String localTopic = topicStr.substring(topicRootLength); - if(baseTopicLength == topicRootLength){ + String baseTopic = topicStr.substring(0, topicRootLength); + if(baseTopic.compareTo(topicRoot) == 0){ + String localTopic = topicStr.substring(topicRootLength); String direction = localTopic.substring(0,4); if(direction == "/in/" ){ String localSubTopic = localTopic.substring(direction.length());