diff --git a/src/ImageBrownDistortionModel.cc b/src/ImageBrownDistortionModel.cc index a7289ff8..57c02fae 100644 --- a/src/ImageBrownDistortionModel.cc +++ b/src/ImageBrownDistortionModel.cc @@ -107,6 +107,12 @@ void ImageBrownDistortionModel::SetCamera(rendering::CameraPtr _camera) // add distortion pass rendering::RenderPassPtr distortionPass = rpSystem->Create(); + if (!distortionPass) + { + ignwarn << "ImageBrownDistortionModel is not supported in " + << engine->Name() << std::endl; + return; + } this->dataPtr->distortionPass = std::dynamic_pointer_cast(distortionPass); this->dataPtr->distortionPass->SetK1(this->dataPtr->k1); diff --git a/src/ImageGaussianNoiseModel.cc b/src/ImageGaussianNoiseModel.cc index 5f4bf803..bd321e43 100644 --- a/src/ImageGaussianNoiseModel.cc +++ b/src/ImageGaussianNoiseModel.cc @@ -93,6 +93,12 @@ void ImageGaussianNoiseModel::SetCamera(rendering::CameraPtr _camera) // add gaussian noise pass rendering::RenderPassPtr noisePass = rpSystem->Create(); + if (!noisePass) + { + ignwarn << "ImageGaussianNoiseModel is not supported in " + << engine->Name() << std::endl; + return; + } this->dataPtr->gaussianNoisePass = std::dynamic_pointer_cast(noisePass); this->dataPtr->gaussianNoisePass->SetMean(this->dataPtr->mean);