Skip to content

Commit

Permalink
Fix CameraSensor to check if element is null before access
Browse files Browse the repository at this point in the history
Signed-off-by: Levi Armstrong <[email protected]>
  • Loading branch information
Levi-Armstrong committed Jul 19, 2023
1 parent a5a0c34 commit 6b511ed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/CameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ bool CameraSensor::CreateCamera()
this->dataPtr->camera->SetAspectRatio(static_cast<double>(width)/height);
this->dataPtr->camera->SetHFOV(angle);

if (cameraSdf->Element()->HasElement("distortion")) {
if (cameraSdf->Element() != nullptr && cameraSdf->Element()->HasElement("distortion")) {
this->dataPtr->distortion =
ImageDistortionFactory::NewDistortionModel(*cameraSdf, "camera");
this->dataPtr->distortion->Load(*cameraSdf);
Expand Down

0 comments on commit 6b511ed

Please sign in to comment.