Skip to content

Commit

Permalink
Handle a failed rcl_take() call in rclpy_take(). (#550)
Browse files Browse the repository at this point in the history
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
  • Loading branch information
hidmic authored Apr 27, 2020
1 parent 956227f commit 3d6be20
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions rclpy/src/rclpy/_rclpy.c
Original file line number Diff line number Diff line change
Expand Up @@ -3346,13 +3346,15 @@ rclpy_take(PyObject * Py_UNUSED(self), PyObject * args)
return NULL;
}

if (ret != RCL_RET_SUBSCRIPTION_TAKE_FAILED) {
pytaken_msg = rclpy_convert_to_py(taken_msg, pymsg_type);
destroy_ros_message(taken_msg);
if (!pytaken_msg) {
// the function has set the Python error
return NULL;
}
if (RCL_RET_SUBSCRIPTION_TAKE_FAILED == ret) {
return PyTuple_Pack(2, Py_None, Py_None);
}

pytaken_msg = rclpy_convert_to_py(taken_msg, pymsg_type);
destroy_ros_message(taken_msg);
if (!pytaken_msg) {
// the function has set the Python error
return NULL;
}
}

Expand Down

0 comments on commit 3d6be20

Please sign in to comment.