Skip to content

Commit

Permalink
Throw exception for invalid table sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 13, 2018
1 parent 82029f9 commit 81d5a2d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/analysis/processing/qgsalgorithmreclassifybylayer.cpp
Expand Up @@ -273,6 +273,9 @@ bool QgsReclassifyByTableAlgorithm::_prepareAlgorithm( const QVariantMap &, QgsP
QVector<QgsReclassifyUtils::RasterClass> QgsReclassifyByTableAlgorithm::createClasses( QgsReclassifyUtils::RasterClass::BoundsType boundsType, const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback * )
{
const QVariantList table = parameterAsMatrix( parameters, QStringLiteral( "TABLE" ), context );
if ( table.count() % 3 != 0 )
throw QgsProcessingException( QObject::tr( "Invalid value for TABLE: list must contain a multiple of 3 elements (found %1)" ).arg( table.count() ) );

const int rows = table.count() / 3;
QVector< QgsReclassifyUtils::RasterClass > classes;
for ( int row = 0; row < rows; ++row )
Expand Down

0 comments on commit 81d5a2d

Please sign in to comment.