throw exception if environment variable is not an integer (#78)
This commit is contained in:
parent
780ddf4367
commit
69dcd0c566
1 changed files with 2 additions and 4 deletions
|
@ -53,11 +53,9 @@ Node::Node(const std::string & node_name, context::Context::SharedPtr context)
|
||||||
if (ros_domain_id) {
|
if (ros_domain_id) {
|
||||||
unsigned long number = strtoul(ros_domain_id, NULL, 0);
|
unsigned long number = strtoul(ros_domain_id, NULL, 0);
|
||||||
if (number == (std::numeric_limits<unsigned long>::max)()) {
|
if (number == (std::numeric_limits<unsigned long>::max)()) {
|
||||||
fprintf(stderr,
|
throw std::runtime_error("failed to interpret ROS_DOMAIN_ID as integral number");
|
||||||
"Failed to interpret ROS_DOMAIN_ID '%s' as integral number\n", ros_domain_id);
|
|
||||||
} else {
|
|
||||||
domain_id = static_cast<size_t>(number);
|
|
||||||
}
|
}
|
||||||
|
domain_id = static_cast<size_t>(number);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto node = rmw_create_node(name_.c_str(), domain_id);
|
auto node = rmw_create_node(name_.c_str(), domain_id);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue