Fix the potential application crash issues (#426)
* err msg * err msg * Fix the potential application crash issues Signed-off-by: Ethan Gao <ethan.gao@linux.intel.com> * minor tweak the code structure Signed-off-by: Ethan Gao <ethan.gao@linux.intel.com>
This commit is contained in:
parent
bea1a52e24
commit
199a26984d
2 changed files with 13 additions and 2 deletions
|
@ -158,8 +158,13 @@ public:
|
|||
std::string("rcl_service_t in constructor argument must be initialized beforehand."));
|
||||
// *INDENT-ON*
|
||||
}
|
||||
|
||||
const char * service_name = rcl_service_get_service_name(service_handle);
|
||||
if (!service_name) {
|
||||
throw std::runtime_error("failed to get service name");
|
||||
}
|
||||
service_handle_ = service_handle;
|
||||
service_name_ = std::string(rcl_service_get_service_name(service_handle));
|
||||
service_name_ = std::string(service_name);
|
||||
owns_rcl_handle_ = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -170,7 +170,13 @@ PublisherBase::setup_intra_process(
|
|||
StoreMessageCallbackT callback,
|
||||
const rcl_publisher_options_t & intra_process_options)
|
||||
{
|
||||
auto intra_process_topic_name = std::string(this->get_topic_name()) + "/_intra";
|
||||
const char * topic_name = this->get_topic_name();
|
||||
if (!topic_name) {
|
||||
throw std::runtime_error("failed to get topic name");
|
||||
}
|
||||
|
||||
auto intra_process_topic_name = std::string(topic_name) + "/_intra";
|
||||
|
||||
rcl_ret_t ret = rcl_publisher_init(
|
||||
&intra_process_publisher_handle_,
|
||||
rcl_node_handle_.get(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue