File tree 2 files changed +7
-0
lines changed
2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -196,6 +196,10 @@ class CORE_EXPORT QgsFields
196
196
inline int count () const { return mFields .count (); }
197
197
// ! Return number of items
198
198
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 (); }
199
203
200
204
// ! Get field at particular index (must be in range 0..N-1)
201
205
inline const QgsField& operator []( int i ) const { return mFields [i].field ; }
Original file line number Diff line number Diff line change @@ -351,6 +351,9 @@ void QgsVectorLayerFeatureIterator::prepareJoins()
351
351
352
352
for ( QgsAttributeList::const_iterator attIt = fetchAttributes.constBegin (); attIt != fetchAttributes.constEnd (); ++attIt )
353
353
{
354
+ if ( !fields.exists ( *attIt ) )
355
+ continue ;
356
+
354
357
if ( fields.fieldOrigin ( *attIt ) != QgsFields::OriginJoin )
355
358
continue ;
356
359
You can’t perform that action at this time.
0 commit comments