Skip to content
Permalink
Browse files

Check for index validity and do not crash!

  • Loading branch information
elpaso committed Apr 19, 2018
1 parent bd65fc6 commit 222f3ad9e01dd80cb2ff00bfedb112662594db44
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/core/qgsvectordataprovider.cpp
@@ -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 ) )
{

0 comments on commit 222f3ad

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