Skip to content

Commit 91d4452

Browse files
committed
- fixed a bug that occur when handling bulk read item that does not exist.
1 parent 21e9a81 commit 91d4452

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

robotis_device/src/robotis_device/robot.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,13 @@ Robot::Robot(std::string robot_file_path, std::string dev_desc_dir_path)
154154
uint16_t indirect_data_addr = dxl->ctrl_table_[INDIRECT_DATA_1]->address_;
155155
for (int _i = 0; _i < sub_tokens.size(); _i++)
156156
{
157+
std::map<std::string, ControlTableItem *>::iterator bulkread_it = dxl->ctrl_table_.find(sub_tokens[_i]);
158+
if(bulkread_it == dxl->ctrl_table_.end())
159+
{
160+
fprintf(stderr, "\n ##### BULK READ ITEM [ %s ] NOT FOUND!! #####\n\n", sub_tokens[_i].c_str());
161+
continue;
162+
}
163+
157164
dxl->bulk_read_items_.push_back(new ControlTableItem());
158165
ControlTableItem *dest_item = dxl->bulk_read_items_[_i];
159166
ControlTableItem *src_item = dxl->ctrl_table_[sub_tokens[_i]];

0 commit comments

Comments
 (0)