Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
Fix ReadFromBuffer() for empty strings in Debug mode with assertions …
Browse files Browse the repository at this point in the history
…enabled
  • Loading branch information
meyerj committed Oct 18, 2021
1 parent f874a6f commit 0cb17e5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/ros_msg_parser/helper_functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ template <> inline void ReadFromBuffer( const Span<const uint8_t>& buffer, size_
throw std::runtime_error("Buffer overrun in RosMsgParser::ReadFromBuffer");
}

if (string_size == 0) {
destination = std::string();
return;
}

const char* buffer_ptr = reinterpret_cast<const char*>( &buffer[offset] );
offset += string_size;

Expand Down

0 comments on commit 0cb17e5

Please sign in to comment.