Skip to content

Commit 7e20f4e

Browse files
committed
fix: Handle empty read data list in Dynamixel read operations
1 parent 44d3f8f commit 7e20f4e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/dynamixel/dynamixel.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,12 @@ DxlError Dynamixel::SetMultiDxlRead()
318318
}
319319
fprintf(stderr, "\n");
320320
fprintf(stderr, "Read items : ");
321-
for (auto it_read_data_list_item_name : read_data_list_.at(0).item_name) {
322-
fprintf(stderr, "\t%s", it_read_data_list_item_name.c_str());
321+
if (!read_data_list_.empty()) {
322+
for (auto it_read_data_list_item_name : read_data_list_.at(0).item_name) {
323+
fprintf(stderr, "\t%s", it_read_data_list_item_name.c_str());
324+
}
325+
} else {
326+
fprintf(stderr, "(none)");
323327
}
324328
fprintf(stderr, "\n");
325329
} else {

0 commit comments

Comments
 (0)