File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,7 +75,20 @@ void DepthCamera::Configure(const Entity& _entity,
7575 components::Name (sensorName),
7676 components::Sensor ());
7777
78- auto sdfSensor = _ecm.ComponentData <components::RgbdCamera>(sensor).value ().Element ();
78+ auto sdfSensS = _ecm.ComponentData <components::RgbdCamera>(sensor);
79+
80+ if (!sdfSensS.has_value ())
81+ {
82+ yError () << " gz-sim-yarp-depthcamera-system : the given sensor is not of type='rgbd_camera'" ;
83+ return ;
84+ }
85+ auto sdfSensor = sdfSensS.value ().Element ();
86+ if (sdfSensor == nullptr )
87+ {
88+ yError () << " gz-sim-yarp-depthcamera-system : sdfSensS.value().Element() is nullptr" ;
89+ return ;
90+ }
91+
7992 // auto A = sensorPippo->getDepthCamera();
8093 auto sdfCamera = sdfSensor->GetElement (" camera" ).get ();
8194 auto sdfImage = sdfCamera->GetElement (" image" ).get ();
You can’t perform that action at this time.
0 commit comments