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

BUG: Fixing null pointer error seen in tests

parent d63d3247
No related branches found
No related tags found
No related merge requests found
......@@ -42,7 +42,12 @@ void OGRVersionProxy::Close(GDALDatasetType * dataset)
OGRVersionProxy::GDALDatasetType * OGRVersionProxy::Create(GDALDriverType * driver, const char * name)
{
return driver->CreateDataSource(name);
GDALDatasetType * ds = driver->CreateDataSource(name);
if(ds)
ds->SetDriver(driver);
return ds;
}
bool OGRVersionProxy::Delete(GDALDriverType * driver, const char * name)
......
......@@ -675,7 +675,10 @@ private:
//and recomputed FID for each features (without holes).
//Note : the GetDriver() Method has not been encapsulated in otb::ogr::DataSource,
//so we must access the OGR pointer by using .ogr()
std::string driverName(ogrDS->ogr().GetDriver()->GetName());
otb::OGRVersionProxy::GDALDatasetType & gdalDS = ogrDS->ogr();
otb::OGRVersionProxy::GDALDriverType * gdalDriver = gdalDS.GetDriver();
std::string driverName(gdalDriver->GetName());
if ( driverName.find("ESRI Shapefile") != std::string::npos)
{
otbAppLogINFO(<<"REPACK the Shapefile ..."<<std::endl);
......
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