Skip to content
Permalink
Browse files

GDAL provider: don't crash on invalid bands

  • Loading branch information
github-actions authored and nyalldawson committed Oct 13, 2020
1 parent d4c963e commit f4423aaf7d8ebd7b061b97e3ac5d2e12a40b2ddc
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/core/providers/gdal/qgsgdalprovider.cpp
@@ -1063,6 +1063,12 @@ QString QgsGdalProvider::generateBandName( int bandNumber ) const
}
QString generatedBandName = QgsRasterDataProvider::generateBandName( bandNumber );
GDALRasterBandH myGdalBand = getBand( bandNumber );
if ( ! myGdalBand )
{
QgsLogger::warning( QStringLiteral( "Band %1 does not exist." ).arg( bandNumber ) );
return QString();
}

QString gdalBandName( GDALGetDescription( myGdalBand ) );
if ( !gdalBandName.isEmpty() )
{

0 comments on commit f4423aa

Please sign in to comment.
You can’t perform that action at this time.