Skip to content

Commit

Permalink
Add checks for empty parameter space data in TincProtocol
Browse files Browse the repository at this point in the history
  • Loading branch information
mantaraya36 committed Dec 21, 2020
1 parent 3ec521c commit e63792b
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions src/TincProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -838,9 +838,13 @@ bool processConfigureParameterMessage(ConfigureParameter &conf,
idsIt++;
}
}
dim->setSpaceValues(newValues, "", src);
dim->setSpaceIds(newIds, src);
dim->conformSpace();
if (newIds.size() > 0 || newValues.size() > 0) {
dim->setSpaceValues(newValues, "", src);
dim->setSpaceIds(newIds, src);
dim->conformSpace();
} else {
std::cout << "Warning: got empty parameter space values" << std::endl;
}
} else if (dim->getSpaceDataType() ==
al::DiscreteParameterValues::UINT8) {
std::vector<uint8_t> newValues;
Expand All @@ -853,9 +857,13 @@ bool processConfigureParameterMessage(ConfigureParameter &conf,
idsIt++;
}
}
dim->setSpaceValues(newValues.data(), newValues.size(), "", src);
dim->setSpaceIds(newIds, src);
dim->conformSpace();
if (newIds.size() > 0 || newValues.size() > 0) {
dim->setSpaceValues(newValues.data(), newValues.size(), "", src);
dim->setSpaceIds(newIds, src);
dim->conformSpace();
} else {
std::cout << "Warning: got empty parameter space values" << std::endl;
}
} else if (dim->getSpaceDataType() ==
al::DiscreteParameterValues::INT32) {
std::vector<int32_t> newValues;
Expand All @@ -868,9 +876,13 @@ bool processConfigureParameterMessage(ConfigureParameter &conf,
idsIt++;
}
}
dim->setSpaceValues(newValues.data(), newValues.size(), "", src);
dim->setSpaceIds(newIds, src);
dim->conformSpace();
if (newIds.size() > 0 || newValues.size() > 0) {
dim->setSpaceValues(newValues.data(), newValues.size(), "", src);
dim->setSpaceIds(newIds, src);
dim->conformSpace();
} else {
std::cout << "Warning: got empty parameter space values" << std::endl;
}
} else if (dim->getSpaceDataType() ==
al::DiscreteParameterValues::UINT32) {
std::vector<uint32_t> newValues;
Expand All @@ -883,9 +895,13 @@ bool processConfigureParameterMessage(ConfigureParameter &conf,
idsIt++;
}
}
dim->setSpaceValues(newValues.data(), newValues.size(), "", src);
dim->setSpaceIds(newIds, src);
dim->conformSpace();
if (newIds.size() > 0 || newValues.size() > 0) {
dim->setSpaceValues(newValues.data(), newValues.size(), "", src);
dim->setSpaceIds(newIds, src);
dim->conformSpace();
} else {
std::cout << "Warning: got empty parameter space values" << std::endl;
}
}
// FIXME add all types
} else {
Expand Down

0 comments on commit e63792b

Please sign in to comment.