Skip to content

Commit

Permalink
Update rmw_publish_serialized_message() error returns (#431)
Browse files Browse the repository at this point in the history
Signed-off-by: lobotuerk <jtlorente@ekumenlabs.com>
  • Loading branch information
Lobotuerk authored and ahcorde committed Oct 8, 2020
1 parent 27e4b1b commit bd3aa26
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions rmw_fastrtps_shared_cpp/src/rmw_publish.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "rmw/allocators.h"
#include "rmw/error_handling.h"
#include "rmw/rmw.h"
#include "rmw/impl/cpp/macros.hpp"

#include "rmw_fastrtps_shared_cpp/rmw_common.hpp"
#include "rmw_fastrtps_shared_cpp/custom_publisher_info.hpp"
Expand Down Expand Up @@ -65,14 +66,15 @@ __rmw_publish_serialized_message(
rmw_publisher_allocation_t * allocation)
{
(void) allocation;
RCUTILS_CHECK_FOR_NULL_WITH_MSG(publisher, "publisher pointer is null", return RMW_RET_ERROR);
RCUTILS_CHECK_FOR_NULL_WITH_MSG(
serialized_message, "serialized_message pointer is null", return RMW_RET_ERROR);

if (publisher->implementation_identifier != identifier) {
RMW_SET_ERROR_MSG("publisher handle not from this implementation");
return RMW_RET_ERROR;
}
RMW_CHECK_FOR_NULL_WITH_MSG(
publisher, "publisher handle is null",
return RMW_RET_INVALID_ARGUMENT);
RMW_CHECK_TYPE_IDENTIFIERS_MATCH(
publisher, publisher->implementation_identifier, identifier,
return RMW_RET_INCORRECT_RMW_IMPLEMENTATION);
RMW_CHECK_FOR_NULL_WITH_MSG(
serialized_message, "serialized message handle is null",
return RMW_RET_INVALID_ARGUMENT);

auto info = static_cast<CustomPublisherInfo *>(publisher->data);
RCUTILS_CHECK_FOR_NULL_WITH_MSG(info, "publisher info pointer is null", return RMW_RET_ERROR);
Expand Down

0 comments on commit bd3aa26

Please sign in to comment.