Commit 90aa8afb authored by Christophe Palmann's avatar Christophe Palmann

ENH: otbSensorModemAdapater.cxx, added some null pointer checkings

parent 619b808c
......@@ -208,6 +208,8 @@ double SensorModelAdapter::Optimize()
// Call optimize fit
precision = sensorModel->optimizeFit(*m_TiePoints);
}
else
itkExceptionMacro(<< "Optimize(): error, dynamic_cast from ossimProjection* to ossimSensorModel* failed.");
}
// Return the precision
......@@ -238,11 +240,13 @@ bool SensorModelAdapter::WriteGeomFile(const std::string & outfile)
// try to retrieve a sensor model
ossimSensorModel * sensorModel = NULL;
sensorModel = dynamic_cast<ossimSensorModel *>(m_SensorModel);
if (sensorModel == NULL)
itkExceptionMacro(<< "WriteGeomFile(): error, dynamic_cast from ossimProjection* to ossimSensorModel* failed.");
ossimKeywordlist geom;
bool success = sensorModel->saveState(geom);
if(success)
{
return geom.write(outfile.c_str());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment