Skip to content

Commit

Permalink
fix compilation warning: stream_type may be used uninitialized
Browse files Browse the repository at this point in the history
  • Loading branch information
SamerKhshiboun committed Apr 7, 2024
1 parent 314948b commit d80ccf4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions realsense2_camera/src/ros_sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

#include <ros_sensor.h>
#include <assert.h>

using namespace realsense2_camera;
using namespace rs2;
Expand Down Expand Up @@ -409,7 +410,7 @@ void RosSensor::set_sensor_auto_exposure_roi()
{
try
{
rs2_stream stream_type;
rs2_stream stream_type = RS2_STREAM_ANY;
if (this->rs2::sensor::is<rs2::depth_sensor>())
{
stream_type = RS2_STREAM_DEPTH;
Expand All @@ -418,6 +419,7 @@ void RosSensor::set_sensor_auto_exposure_roi()
{
stream_type = RS2_STREAM_COLOR;
}
assert(stream_type != RS2_STREAM_ANY);

int width = std::dynamic_pointer_cast<VideoProfilesManager>(_profile_managers[0])->getWidth(stream_type);
int height = std::dynamic_pointer_cast<VideoProfilesManager>(_profile_managers[0])->getHeight(stream_type);
Expand Down Expand Up @@ -451,7 +453,7 @@ void RosSensor::registerAutoExposureROIOptions()

if (this->rs2::sensor::is<rs2::roi_sensor>())
{
rs2_stream stream_type;
rs2_stream stream_type = RS2_STREAM_ANY;
if (this->rs2::sensor::is<rs2::depth_sensor>())
{
stream_type = RS2_STREAM_DEPTH;
Expand All @@ -460,7 +462,8 @@ void RosSensor::registerAutoExposureROIOptions()
{
stream_type = RS2_STREAM_COLOR;
}

assert(stream_type != RS2_STREAM_ANY);

int width = std::dynamic_pointer_cast<VideoProfilesManager>(_profile_managers[0])->getWidth(stream_type);
int height = std::dynamic_pointer_cast<VideoProfilesManager>(_profile_managers[0])->getHeight(stream_type);

Expand Down

0 comments on commit d80ccf4

Please sign in to comment.