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
  • Loading branch information
Levi-Armstrong committed Jul 19, 2023
1 parent a5a0c34 commit 76c8991
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 76c8991

Please sign in to comment.