Skip to content

Commit 4df00a8

Browse files
committed
Merge branch 'master' of github.com:qgis/Quantum-GIS
2 parents 813459d + f428c86 commit 4df00a8

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/core/qgsfield.h

+4
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ class CORE_EXPORT QgsFields
196196
inline int count() const { return mFields.count(); }
197197
//! Return number of items
198198
inline int size() const { return mFields.count(); }
199+
//! Return if a field index is valid
200+
//! @param i Index of the field which needs to be checked
201+
//! @return True if the field exists
202+
inline bool exists( int i ) const { return i >= 0 && i < mFields.count(); }
199203

200204
//! Get field at particular index (must be in range 0..N-1)
201205
inline const QgsField& operator[]( int i ) const { return mFields[i].field; }

src/core/qgsvectorlayerfeatureiterator.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,9 @@ void QgsVectorLayerFeatureIterator::prepareJoins()
351351

352352
for ( QgsAttributeList::const_iterator attIt = fetchAttributes.constBegin(); attIt != fetchAttributes.constEnd(); ++attIt )
353353
{
354+
if ( !fields.exists( *attIt ) )
355+
continue;
356+
354357
if ( fields.fieldOrigin( *attIt ) != QgsFields::OriginJoin )
355358
continue;
356359

0 commit comments

Comments
 (0)