Skip to content

Commit

Permalink
PR #2713 from danielhonies: protect empty string dereference
Browse files Browse the repository at this point in the history
  • Loading branch information
Nir-Az authored May 1, 2023
2 parents 1affd4c + 8fab7a4 commit dad99e5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion realsense2_camera/src/realsense_node_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ void RealSenseNodeFactory::init()
_reconnect_timeout = declare_parameter("reconnect_timeout", 6.0);

// A ROS2 hack: until a better way is found to avoid auto convertion of strings containing only digits to integers:
if (_serial_no.front() == '_') _serial_no = _serial_no.substr(1); // remove '_' prefix
if (!_serial_no.empty() && _serial_no.front() == '_') _serial_no = _serial_no.substr(1); // remove '_' prefix

std::string rosbag_filename(declare_parameter("rosbag_filename", rclcpp::ParameterValue("")).get<rclcpp::PARAMETER_STRING>());
if (!rosbag_filename.empty())
Expand Down

0 comments on commit dad99e5

Please sign in to comment.