mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
Check for index validity and do not crash!
This commit is contained in:
parent
bd65fc607b
commit
222f3ad9e0
@ -426,6 +426,12 @@ QVariant QgsVectorDataProvider::maximumValue( int index ) const
|
||||
|
||||
QStringList QgsVectorDataProvider::uniqueStringsMatching( int index, const QString &substring, int limit, QgsFeedback *feedback ) const
|
||||
{
|
||||
QStringList results;
|
||||
|
||||
// Safety belt
|
||||
if ( index < 0 || index >= fields().count() )
|
||||
return results;
|
||||
|
||||
QgsFeature f;
|
||||
QgsAttributeList keys;
|
||||
keys.append( index );
|
||||
@ -438,7 +444,6 @@ QStringList QgsVectorDataProvider::uniqueStringsMatching( int index, const QStri
|
||||
QgsFeatureIterator fi = getFeatures( request );
|
||||
|
||||
QSet<QString> set;
|
||||
QStringList results;
|
||||
|
||||
while ( fi.nextFeature( f ) )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user