Skip to content
Permalink
Browse files
Fix ticket #5584 (crash saving empty geometry)
  • Loading branch information
mhugent committed Feb 5, 2013
1 parent f47d820 commit 96a8bd64d8cdd4aecdf9e0789d525cf09f44e6a1
Showing with 8 additions and 6 deletions.
  1. +8 −6 src/providers/ogr/qgsogrprovider.cpp
@@ -566,7 +566,7 @@ void QgsOgrProvider::loadFields()
}

mAttributeFields.append(
QgsField(
QgsField(
//TODO: fix this hack
#ifdef ANDROID
OGR_Fld_GetNameRef( fldDef ),
@@ -757,13 +757,15 @@ bool QgsOgrProvider::addFeature( QgsFeature& f )
unsigned char* wkb = f.geometry()->asWkb();
OGRGeometryH geom = NULL;

if ( OGR_G_CreateFromWkb( wkb, NULL, &geom, f.geometry()->wkbSize() ) != OGRERR_NONE )
if ( wkb )
{
pushError( tr( "OGR error creating wkb for feature %1: %2" ).arg( f.id() ).arg( CPLGetLastErrorMsg() ) );
return false;
if ( OGR_G_CreateFromWkb( wkb, NULL, &geom, f.geometry()->wkbSize() ) != OGRERR_NONE )
{
pushError( tr( "OGR error creating wkb for feature %1: %2" ).arg( f.id() ).arg( CPLGetLastErrorMsg() ) );
return false;
}
OGR_F_SetGeometryDirectly( feature, geom );
}

OGR_F_SetGeometryDirectly( feature, geom );
}

const QgsAttributes& attrs = f.attributes();

0 comments on commit 96a8bd6

Please sign in to comment.