Skip to content

Commit 81d5a2d

Browse files
committed
Throw exception for invalid table sizes
1 parent 82029f9 commit 81d5a2d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/analysis/processing/qgsalgorithmreclassifybylayer.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,9 @@ bool QgsReclassifyByTableAlgorithm::_prepareAlgorithm( const QVariantMap &, QgsP
273273
QVector<QgsReclassifyUtils::RasterClass> QgsReclassifyByTableAlgorithm::createClasses( QgsReclassifyUtils::RasterClass::BoundsType boundsType, const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback * )
274274
{
275275
const QVariantList table = parameterAsMatrix( parameters, QStringLiteral( "TABLE" ), context );
276+
if ( table.count() % 3 != 0 )
277+
throw QgsProcessingException( QObject::tr( "Invalid value for TABLE: list must contain a multiple of 3 elements (found %1)" ).arg( table.count() ) );
278+
276279
const int rows = table.count() / 3;
277280
QVector< QgsReclassifyUtils::RasterClass > classes;
278281
for ( int row = 0; row < rows; ++row )

0 commit comments

Comments
 (0)