From 0cbf2395933f47688be7d6b9f3df44440e73fe8f Mon Sep 17 00:00:00 2001 From: Julien Michel <julien.michel@orfeo-toolbox.org> Date: Tue, 19 Jun 2012 17:27:22 +0200 Subject: [PATCH] BUG: Fixing potential bug on number of layers in dataset --- .../OGRAdapters/otbOGRDataSourceWrapper.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Code/UtilitiesAdapters/OGRAdapters/otbOGRDataSourceWrapper.cxx b/Code/UtilitiesAdapters/OGRAdapters/otbOGRDataSourceWrapper.cxx index c93c62ac82..edb33c7681 100644 --- a/Code/UtilitiesAdapters/OGRAdapters/otbOGRDataSourceWrapper.cxx +++ b/Code/UtilitiesAdapters/OGRAdapters/otbOGRDataSourceWrapper.cxx @@ -411,7 +411,13 @@ void otb::ogr::DataSource::GetGlobalExtent(double & ulx, OGREnvelope sExtent; const_iterator lit = this->begin(); - const OGRErr res = lit->ogr().GetExtent(&sExtent,force); + if(lit==this->end()) + { + itkGenericExceptionMacro(<< "Cannot compute global extent because there are no layers in the DataSource"); + } + + const OGRErr res = lit->ogr().GetExtent(&sExtent,force); + if(res!= OGRERR_NONE) { -- GitLab