diff --git a/src/core/qgsrelation.cpp b/src/core/qgsrelation.cpp index b936b98f2cf..e622cbf9da7 100644 --- a/src/core/qgsrelation.cpp +++ b/src/core/qgsrelation.cpp @@ -187,18 +187,19 @@ QgsFeatureRequest QgsRelation::getReferencedFeatureRequest( const QgsAttributes& { int referencedIdx = referencedLayer()->fields().indexFromName( fieldPair.referencedField() ); int referencingIdx = referencingLayer()->fields().indexFromName( fieldPair.referencingField() ); + Q_UNUSED(referencingIdx); QgsField referencedField = referencedLayer()->fields().at( referencedIdx ); if ( referencedField.type() == QVariant::String ) { // Use quotes - conditions << QString( "\"%1\" = '%2'" ).arg( fieldPair.referencedField(), attributes.at( referencingIdx ).toString() ); + conditions << QString( "\"%1\" = '%2'" ).arg( fieldPair.referencedField(), attributes.at( referencedIdx ).toString() ); } else { // No quotes - conditions << QString( "\"%1\" = %2" ).arg( fieldPair.referencedField(), attributes.at( referencingIdx ).toString() ); + conditions << QString( "\"%1\" = %2" ).arg( fieldPair.referencedField(), attributes.at( referencedIdx ).toString() ); } }