Add validation for invalid property range (min > max)

This commit is contained in:
obyalian
2025-09-28 09:39:13 +08:00
parent 76be16fb6e
commit 1ab5000086
2 changed files with 26 additions and 22 deletions
+8
View File
@@ -406,6 +406,14 @@ void OBCameraNode::setAutoExposureCallback(
return;
}
auto range = device_->getIntPropertyRange(prop_id);
if (range.min > range.max) {
response->success = false;
response->message = "Property is not supported!";
RCLCPP_WARN_STREAM(logger_, "Property " << prop_id << " is not supported (min > max)");
return;
}
std::cout << range.min << " " << range.max << std::endl;
std::cout << request->data << std::endl;
if (request->data < range.min || request->data > range.max) {
response->success = false;
RCLCPP_INFO_STREAM(logger_, "set auto exposure value out of range");