Skip to content
Permalink
Browse files

fix crash adding features without geometry to a geometry layer

  • Loading branch information
brushtyler committed Oct 18, 2012
1 parent faf46b6 commit bb31a2d17e8070cb27e64d319efa06d4de3b0255
@@ -2368,6 +2368,12 @@ bool QgsPostgresProvider::changeAttributeValues( const QgsChangedAttributesMap &

void QgsPostgresProvider::appendGeomParam( QgsGeometry *geom, QStringList &params ) const
{
if ( !geom )
{
params << QString::null;
return;
}

QString param;
unsigned char *buf = geom->asWkb();
for ( uint i = 0; i < geom->wkbSize(); ++i )
@@ -3674,15 +3674,22 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist )
if ( !mGeometryColumn.isNull() )
{
// binding GEOMETRY to Prepared Statement
unsigned char *wkb = NULL;
size_t wkb_size;
convertFromGeosWKB( features->geometry()->asWkb(),
features->geometry()->wkbSize(),
&wkb, &wkb_size, nDims );
if ( !wkb )
if ( !features->geometry() )
{
sqlite3_bind_null( stmt, ++ia );
}
else
sqlite3_bind_blob( stmt, ++ia, wkb, wkb_size, free );
{
unsigned char *wkb = NULL;
size_t wkb_size;
convertFromGeosWKB( features->geometry()->asWkb(),
features->geometry()->wkbSize(),
&wkb, &wkb_size, nDims );
if ( !wkb )
sqlite3_bind_null( stmt, ++ia );
else
sqlite3_bind_blob( stmt, ++ia, wkb, wkb_size, free );
}
}

for ( QgsAttributeMap::const_iterator it = attributevec.begin(); it != attributevec.end(); it++ )

0 comments on commit bb31a2d

Please sign in to comment.
You can’t perform that action at this time.