Skip to content
Snippets Groups Projects
Commit 99c24492 authored by Julien Michel's avatar Julien Michel
Browse files

COV: Fixing coverity issues (unchecked dynamic cast)

parent a04e7c12
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,11 @@ ImageToOSMVectorDataGenerator<TImage> ...@@ -31,6 +31,11 @@ ImageToOSMVectorDataGenerator<TImage>
{ {
this->SetNumberOfRequiredInputs(1); this->SetNumberOfRequiredInputs(1);
this->SetNumberOfRequiredOutputs(1); this->SetNumberOfRequiredOutputs(1);
m_ImageExtent.minX = 0;
m_ImageExtent.maxX = 0;
m_ImageExtent.minY = 0;
m_ImageExtent.maxY = 0;
} }
template < class TImage > template < class TImage >
......
...@@ -80,6 +80,12 @@ OGRVectorDataIO ...@@ -80,6 +80,12 @@ OGRVectorDataIO
{ {
VectorDataPointerType data = dynamic_cast<VectorDataType*>(datag); VectorDataPointerType data = dynamic_cast<VectorDataType*>(datag);
// Destroy previous opened data source // Destroy previous opened data source
if(!data)
{
itkExceptionMacro(<<"Failed to dynamic cast to otb::VectorData (this should never happen)");
}
if (m_DataSource != NULL) if (m_DataSource != NULL)
{ {
OGRDataSource::DestroyDataSource(m_DataSource); OGRDataSource::DestroyDataSource(m_DataSource);
...@@ -195,6 +201,12 @@ void OGRVectorDataIO::Write(const itk::DataObject* datag, char ** papszOptions) ...@@ -195,6 +201,12 @@ void OGRVectorDataIO::Write(const itk::DataObject* datag, char ** papszOptions)
VectorDataConstPointerType data = dynamic_cast<const VectorDataType*>(datag); VectorDataConstPointerType data = dynamic_cast<const VectorDataType*>(datag);
if(!data)
{
itkExceptionMacro(<<"Failed to dynamic cast to otb::VectorData (this should never happen).");
}
//Find first the OGR driver //Find first the OGR driver
OGRSFDriver * ogrDriver = OGRSFDriver * ogrDriver =
OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(this->GetOGRDriverName(this->m_FileName).data()); OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(this->GetOGRDriverName(this->m_FileName).data());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment