Skip to content

Commit

Permalink
Fix for crash when selecting wfs features
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9508 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Oct 21, 2008
1 parent 0956bf6 commit e38f197
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/providers/wfs/qgswfsprovider.cpp
Expand Up @@ -73,16 +73,14 @@ bool QgsWFSProvider::nextFeature( QgsFeature& feature )
}

feature.setFeatureId( mFeatures[*mFeatureIterator]->id() );
if ( mFetchGeom )
{
QgsGeometry* geometry = mFeatures[*mFeatureIterator]->geometry();
unsigned char *geom = geometry->wkbBuffer();
int geomSize = geometry->wkbSize();

unsigned char* copiedGeom = new unsigned char[geomSize];
memcpy( copiedGeom, geom, geomSize );
feature.setGeometryAndOwnership( copiedGeom, geomSize );
}
//we need geometry anyway, e.g. for intersection tests
QgsGeometry* geometry = mFeatures[*mFeatureIterator]->geometry();
unsigned char *geom = geometry->wkbBuffer();
int geomSize = geometry->wkbSize();
unsigned char* copiedGeom = new unsigned char[geomSize];
memcpy( copiedGeom, geom, geomSize );
feature.setGeometryAndOwnership( copiedGeom, geomSize );

const QgsAttributeMap& attributes = mFeatures[*mFeatureIterator]->attributeMap();
for ( QgsAttributeList::const_iterator it = mAttributesToFetch.begin(); it != mAttributesToFetch.end(); ++it )
Expand All @@ -92,7 +90,7 @@ bool QgsWFSProvider::nextFeature( QgsFeature& feature )
++mFeatureIterator;
if ( mUseIntersect )
{
if ( feature.geometry()->intersects( mSpatialFilter ) )
if ( feature.geometry() && feature.geometry()->intersects( mSpatialFilter ) )
{
return true;
}
Expand Down

0 comments on commit e38f197

Please sign in to comment.