From 4682af41c56a52b33718dea7b76a1a28ecfa41e4 Mon Sep 17 00:00:00 2001 From: Jose Tomas Lorente Date: Fri, 18 Sep 2020 18:42:29 -0300 Subject: [PATCH] Updated error returns on rmw_take_serialized and with_message_info (#242) Signed-off-by: lobotuerk --- rmw_cyclonedds_cpp/src/rmw_node.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/rmw_cyclonedds_cpp/src/rmw_node.cpp b/rmw_cyclonedds_cpp/src/rmw_node.cpp index c3d1291..ac2d5af 100644 --- a/rmw_cyclonedds_cpp/src/rmw_node.cpp +++ b/rmw_cyclonedds_cpp/src/rmw_node.cpp @@ -2667,10 +2667,16 @@ static rmw_ret_t rmw_take_ser_int( rmw_serialized_message_t * serialized_message, bool * taken, rmw_message_info_t * message_info) { - RET_NULL(taken); - RET_NULL(serialized_message); - RET_NULL(subscription); - RET_WRONG_IMPLID(subscription); + RMW_CHECK_ARGUMENT_FOR_NULL( + subscription, RMW_RET_INVALID_ARGUMENT); + RMW_CHECK_ARGUMENT_FOR_NULL( + serialized_message, RMW_RET_INVALID_ARGUMENT); + RMW_CHECK_ARGUMENT_FOR_NULL( + taken, RMW_RET_INVALID_ARGUMENT); + RMW_CHECK_TYPE_IDENTIFIERS_MATCH( + subscription handle, + subscription->implementation_identifier, eclipse_cyclonedds_identifier, + return RMW_RET_INCORRECT_RMW_IMPLEMENTATION) CddsSubscription * sub = static_cast(subscription->data); RET_NULL(sub); dds_sample_info_t info; @@ -2747,6 +2753,10 @@ extern "C" rmw_ret_t rmw_take_serialized_message_with_info( rmw_subscription_allocation_t * allocation) { static_cast(allocation); + + RMW_CHECK_ARGUMENT_FOR_NULL( + message_info, RMW_RET_INVALID_ARGUMENT); + return rmw_take_ser_int(subscription, serialized_message, taken, message_info); }