Skip to content

Commit 44c67b0

Browse files
Fix CameraSensor to check if element is null before access (#361)
* Fix CameraSensor to check if element is null before access Signed-off-by: Levi Armstrong <[email protected]>
1 parent a5a0c34 commit 44c67b0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/CameraSensor.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,8 @@ bool CameraSensor::CreateCamera()
257257
this->dataPtr->camera->SetAspectRatio(static_cast<double>(width)/height);
258258
this->dataPtr->camera->SetHFOV(angle);
259259

260-
if (cameraSdf->Element()->HasElement("distortion")) {
260+
if (cameraSdf->Element() != nullptr &&
261+
cameraSdf->Element()->HasElement("distortion")) {
261262
this->dataPtr->distortion =
262263
ImageDistortionFactory::NewDistortionModel(*cameraSdf, "camera");
263264
this->dataPtr->distortion->Load(*cameraSdf);

0 commit comments

Comments
 (0)