mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
[Fix #7772] Check attribute index before setting attribute to avoid crash
This commit is contained in:
parent
c5142dab20
commit
524e142e11
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user