[Fix #7772] Check attribute index before setting attribute to avoid crash

This commit is contained in:
Matthias Kuhn 2013-05-07 07:47:06 +02:00
parent c5142dab20
commit 524e142e11

View File

@ -184,13 +184,11 @@ void QgsFeature::initAttributes( int fieldCount )
bool QgsFeature::setAttribute( int idx, const QVariant &value )
{
#ifdef QGISDEBUG
if ( idx < 0 || idx >= mAttributes.size() )
{
QgsMessageLog::logMessage( QObject::tr( "Attribute index %1 out of bounds [0;%2[" ).arg( idx ).arg( mAttributes.size() ), QString::null, QgsMessageLog::WARNING );
return false;
}
#endif
mAttributes[idx] = value;
return true;