Skip to content

Commit

Permalink
[spatialite] Fix crash with a subset of attributes request for joined…
Browse files Browse the repository at this point in the history
… field
  • Loading branch information
m-kuhn committed Oct 10, 2013
1 parent 5e14fea commit e32930d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/providers/spatialite/qgsspatialitefeatureiterator.cpp
Expand Up @@ -321,8 +321,19 @@ bool QgsSpatiaLiteFeatureIterator::getFeature( sqlite3_stmt *stmt, QgsFeature &f
}
else
{
int attrIndex = subsetAttributes ? mRequest.subsetOfAttributes()[ic-1] : ic - 1;
feature.setAttribute( attrIndex, getFeatureAttribute( stmt, ic, P->attributeFields[attrIndex].type() ) );
if ( subsetAttributes )
{
if ( mRequest.subsetOfAttributes().contains( ic - 1 ) )
{
int attrIndex = mRequest.subsetOfAttributes()[ic-1];
feature.setAttribute( attrIndex, getFeatureAttribute( stmt, ic, P->attributeFields[attrIndex].type() ) );
}
}
else
{
int attrIndex = subsetAttributes ? mRequest.subsetOfAttributes()[ic-1] : ic - 1;
feature.setAttribute( attrIndex, getFeatureAttribute( stmt, ic, P->attributeFields[attrIndex].type() ) );
}
}
}

Expand Down

0 comments on commit e32930d

Please sign in to comment.