Skip to content

Commit

Permalink
gdal_footprint: return an error if the requested output layer doesn't…
Browse files Browse the repository at this point in the history
… exist
  • Loading branch information
rouault committed Nov 28, 2023
1 parent 5fef7b6 commit e7c00e2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions apps/gdal_footprint_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,12 @@ GetOutputLayerAndUpdateDstDS(const char *pszDest, GDALDatasetH &hDstDS,
if (!psOptions->osDestLayerName.empty())
{
poLayer = poDstDS->GetLayerByName(psOptions->osDestLayerName.c_str());
if (!poLayer)
{
CPLError(CE_Failure, CPLE_AppDefined, "Cannot find layer %s",
psOptions->osDestLayerName.c_str());
return nullptr;
}
}
else if (poDstDS->GetLayerCount() == 1 && poDstDS->GetDriver() &&
EQUAL(poDstDS->GetDriver()->GetDescription(), "ESRI Shapefile"))
Expand Down

0 comments on commit e7c00e2

Please sign in to comment.