Skip to content
Permalink
Browse files

safer handling

  • Loading branch information
roya0045 committed Nov 13, 2020
1 parent 820f3b9 commit 551d56312240dfb9f321a3f253c413321ff0152b
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/core/expression/qgsexpressionfunction.cpp
@@ -5324,10 +5324,10 @@ static QVariant fcnArrayGet( const QVariantList &values, const QgsExpressionCont
{
const QVariantList list = QgsExpressionUtils::getListValue( values.at( 0 ), parent );
const int pos = QgsExpressionUtils::getNativeIntValue( values.at( 1 ), parent );
if ( pos >= list.length() ) return QVariant();
if ( pos < 0 && ( list.length() + pos ) >= 0 )
if ( pos < list.length() && pos >=0 ) return list.at( pos );
elif ( pos < 0 && ( list.length() + pos ) >= 0 )
return list.at( list.length() + pos );
return list.at( pos );
return QVariant();
}

static QVariant fcnArrayFirst( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent, const QgsExpressionNodeFunction * )

0 comments on commit 551d563

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