Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/internal/soem/soem_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,9 @@ SDOReadValue<std::string> EthercatBus::sdo_read<std::string>(const DeviceId devi
}

// Create an std::string out of it
return SDOReadValue<std::string>(result, std::string(data.begin(), data.begin() + result.actual_size_read));
const std::string_view raw{ data.data(), std::min<std::size_t>(result.actual_size_read, data.size()) };
const auto text = raw.substr(0, raw.find('\0'));
return SDOReadValue<std::string>(result, std::string(text));
}

template SDOReadValue<bool> EthercatBus::sdo_read<bool>(DeviceId, SDOIndex, SDOSubIndex);
Expand Down
Loading