Merge pull request #82 from ROBOTIS-GIT/develop

fixed a bug that occurred when parsing the robot file with empty bulk…
This commit is contained in:
Kayman 2019-11-28 15:58:36 +09:00 committed by GitHub
commit c38eb3d5a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -132,7 +132,7 @@ Robot::Robot(std::string robot_file_path, std::string dev_desc_dir_path)
Dynamixel *dxl = dxls_[dev_name];
std::vector<std::string> sub_tokens = split(tokens[6], ',');
if (sub_tokens.size() > 0)
if (sub_tokens.size() > 0 && sub_tokens[0] != "")
{
std::map<std::string, ControlTableItem *>::iterator indirect_it = dxl->ctrl_table_.find(INDIRECT_ADDRESS_1);
if (indirect_it != dxl->ctrl_table_.end()) // INDIRECT_ADDRESS_1 exist
@ -185,7 +185,7 @@ Robot::Robot(std::string robot_file_path, std::string dev_desc_dir_path)
Sensor *sensor = sensors_[dev_name];
std::vector<std::string> sub_tokens = split(tokens[6], ',');
if (sub_tokens.size() > 0)
if (sub_tokens.size() > 0 && sub_tokens[0] != "")
{
std::map<std::string, ControlTableItem *>::iterator indirect_it = sensor->ctrl_table_.find(INDIRECT_ADDRESS_1);
if (indirect_it != sensor->ctrl_table_.end()) // INDIRECT_ADDRESS_1 exist