Skip to content
Permalink
Browse files
Fix for crash when selecting wfs features
git-svn-id: http://svn.osgeo.org/qgis/trunk@9508 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Oct 21, 2008
1 parent ac56ca9 commit 5fa4a71032bcbfdd0a7d67d07ed58535b2c2b7b2
Showing with 8 additions and 10 deletions.
  1. +8 −10 src/providers/wfs/qgswfsprovider.cpp
@@ -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 )
@@ -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;
}

0 comments on commit 5fa4a71

Please sign in to comment.