Skip to content
Permalink
Browse files

Throw exception for invalid table sizes

  • Loading branch information
nyalldawson committed Jun 11, 2018
1 parent 82029f9 commit 81d5a2d87eb12455a6be4d4d71478adbb3c78a4e
Showing with 3 additions and 0 deletions.
  1. +3 −0 src/analysis/processing/qgsalgorithmreclassifybylayer.cpp
@@ -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 )

0 comments on commit 81d5a2d

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