We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent af1e220 commit 4b4c954Copy full SHA for 4b4c954
src/core/raster/qgsrasterlayer.cpp
@@ -712,7 +712,14 @@ const QgsRasterBandStats QgsRasterLayer::bandStatistics( int theBandNo )
712
QgsRasterBandStats myNullReturnStats;
713
return myNullReturnStats;
714
}
715
+
716
// 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
+ }
723
724
QgsRasterBandStats myRasterBandStats = mRasterStatsList[theBandNo - 1];
725
myRasterBandStats.bandNumber = theBandNo;
0 commit comments