Skip to content

Commit f9d5233

Browse files
committed
fix: Add check for empty ID array in Sync Read Handler to prevent unnecessary operations
1 parent 7e20f4e commit f9d5233

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/dynamixel/dynamixel.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,11 @@ DxlError Dynamixel::SetFastSyncReadHandler(std::vector<uint8_t> id_arr)
10591059

10601060
DxlError Dynamixel::SetSyncReadHandler(std::vector<uint8_t> id_arr)
10611061
{
1062+
if (id_arr.size() == 0) {
1063+
fprintf(stderr, "No Sync Read Item, not setting sync read handler\n");
1064+
return DxlError::OK;
1065+
}
1066+
10621067
// Try to set up fast sync read first
10631068
if (use_fast_read_protocol_) {
10641069
DxlError fast_result = SetFastSyncReadHandler(id_arr);

0 commit comments

Comments
 (0)