File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -573,6 +573,11 @@ QString QgsMssqlProvider::storageType() const
573573// Returns the minimum value of an attribute
574574QVariant QgsMssqlProvider::minimumValue ( int index ) const
575575{
576+ if ( index < 0 || index >= mAttributeFields .count () )
577+ {
578+ return QVariant ();
579+ }
580+
576581 // get the field name
577582 QgsField fld = mAttributeFields .at ( index );
578583 QString sql = QStringLiteral ( " select min([%1]) from " )
@@ -605,6 +610,11 @@ QVariant QgsMssqlProvider::minimumValue( int index ) const
605610// Returns the maximum value of an attribute
606611QVariant QgsMssqlProvider::maximumValue ( int index ) const
607612{
613+ if ( index < 0 || index >= mAttributeFields .count () )
614+ {
615+ return QVariant ();
616+ }
617+
608618 // get the field name
609619 QgsField fld = mAttributeFields .at ( index );
610620 QString sql = QStringLiteral ( " select max([%1]) from " )
@@ -637,6 +647,10 @@ QVariant QgsMssqlProvider::maximumValue( int index ) const
637647QSet<QVariant> QgsMssqlProvider::uniqueValues ( int index, int limit ) const
638648{
639649 QSet<QVariant> uniqueValues;
650+ if ( index < 0 || index >= mAttributeFields .count () )
651+ {
652+ return uniqueValues;
653+ }
640654
641655 // get the field name
642656 QgsField fld = mAttributeFields .at ( index );
You can’t perform that action at this time.
0 commit comments