Skip to content
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ class TopicEndpointInfo
/// Construct a TopicEndpointInfo from a rcl_topic_endpoint_info_t.
RCLCPP_PUBLIC
explicit TopicEndpointInfo(const rcl_topic_endpoint_info_t & info)
: node_name_(info.node_name),
node_namespace_(info.node_namespace),
topic_type_(info.topic_type),
: node_name_(info.node_name ? info.node_name : ""),
node_namespace_(info.node_namespace ? info.node_namespace : ""),
topic_type_(info.topic_type ? info.topic_type : ""),
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The null pointer checks added to protect against nullptr values for node_name, node_namespace, and topic_type should be covered by tests. Consider adding a test case that creates a TopicEndpointInfo with an rcl_topic_endpoint_info_t structure containing nullptr values for these fields to verify the fix handles this edge case correctly.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, TopicEndpointInfo has not been tested in any of the test code. Besides, this modification is simple. Is it necessary to add a new test file to test such a simple change?

endpoint_type_(static_cast<rclcpp::EndpointType>(info.endpoint_type)),
qos_profile_({info.qos_profile.history, info.qos_profile.depth}, info.qos_profile),
topic_type_hash_(info.topic_type_hash)
Expand Down