Fix motor subtree being unreachable from ASCII protocol

When get_direct_child() was invoked on an Axis Instrospectable with the
string "motor" it instead returned an Introspectable for
"motor_thermistor".
This is because strncmp("motor", "motor_thermistor", 5) compares to 0.
This commit is contained in:
Samuel Sadok
2020-07-20 12:24:21 +02:00
parent ff6146f055
commit 4cc9b16077
@@ -96,7 +96,7 @@ public:
private:
Introspectable get_direct_child(const char * name, size_t length) const {
for (size_t i = 0; i < type_info_->property_table_length_; ++i) {
if (!strncmp(name, type_info_->property_table_[i].name, length)) {
if (!strncmp(name, type_info_->property_table_[i].name, length) && (length == strlen(type_info_->property_table_[i].name))) {
Introspectable result;
result.storage_ = type_info_->get_child(storage_, i);
result.type_info_ = type_info_->property_table_[i].type_info;