Skip to content

Commit 4b4c954

Browse files
author
jef
committed
fix #1682
git-svn-id: http://svn.osgeo.org/qgis/trunk@10753 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent af1e220 commit 4b4c954

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/core/raster/qgsrasterlayer.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,14 @@ const QgsRasterBandStats QgsRasterLayer::bandStatistics( int theBandNo )
712712
QgsRasterBandStats myNullReturnStats;
713713
return myNullReturnStats;
714714
}
715+
715716
// check if we have previously gathered stats for this band...
717+
if ( theBandNo < 1 || theBandNo > mRasterStatsList.size() )
718+
{
719+
// invalid band id, return nothing
720+
QgsRasterBandStats myNullReturnStats;
721+
return myNullReturnStats;
722+
}
716723

717724
QgsRasterBandStats myRasterBandStats = mRasterStatsList[theBandNo - 1];
718725
myRasterBandStats.bandNumber = theBandNo;

0 commit comments

Comments
 (0)