Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Check for index validity and do not crash!
  • Loading branch information
elpaso committed Jun 1, 2018
1 parent bd65fc6 commit 222f3ad
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/core/qgsvectordataprovider.cpp
Expand Up @@ -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 );
Expand All @@ -438,7 +444,6 @@ QStringList QgsVectorDataProvider::uniqueStringsMatching( int index, const QStri
QgsFeatureIterator fi = getFeatures( request );

QSet<QString> set;
QStringList results;

while ( fi.nextFeature( f ) )
{
Expand Down

0 comments on commit 222f3ad

Please sign in to comment.