Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check the context validity before accessing the session #403

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions rmw_zenoh_cpp/src/rmw_zenoh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,10 @@ rmw_create_publisher(
context_impl,
"unable to get rmw_context_impl_s",
return nullptr);
if (context_impl->is_shutdown()) {
RMW_SET_ERROR_MSG("context_impl is shutdown");
return nullptr;
}
if (!context_impl->session_is_valid()) {
RMW_SET_ERROR_MSG("zenoh session is invalid");
return nullptr;
Expand Down Expand Up @@ -936,6 +940,10 @@ rmw_create_subscription(
context_impl,
"unable to get rmw_context_impl_s",
return nullptr);
if (context_impl->is_shutdown()) {
RMW_SET_ERROR_MSG("context_impl is shutdown");
return nullptr;
}
if (!context_impl->session_is_valid()) {
RMW_SET_ERROR_MSG("zenoh session is invalid");
return nullptr;
Expand Down Expand Up @@ -1439,6 +1447,10 @@ rmw_create_client(
context_impl,
"unable to get rmw_context_impl_s",
return nullptr);
if (context_impl->is_shutdown()) {
RMW_SET_ERROR_MSG("context_impl is shutdown");
return nullptr;
}
if (!context_impl->session_is_valid()) {
RMW_SET_ERROR_MSG("zenoh session is invalid");
return nullptr;
Expand Down Expand Up @@ -1701,6 +1713,10 @@ rmw_create_service(
context_impl,
"unable to get rmw_context_impl_s",
return nullptr);
if (context_impl->is_shutdown()) {
RMW_SET_ERROR_MSG("context_impl is shutdown");
return nullptr;
}
if (!context_impl->session_is_valid()) {
RMW_SET_ERROR_MSG("zenoh session is invalid");
return nullptr;
Expand Down
Loading