[QGIS Commit] r14492 - trunk/qgis/src/core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Nov 2 18:35:52 EDT 2010


Author: jef
Date: 2010-11-02 15:35:52 -0700 (Tue, 02 Nov 2010)
New Revision: 14492

Modified:
   trunk/qgis/src/core/qgsvectorfilewriter.cpp
Log:
fix filewriter crash

Modified: trunk/qgis/src/core/qgsvectorfilewriter.cpp
===================================================================
--- trunk/qgis/src/core/qgsvectorfilewriter.cpp	2010-11-02 19:26:31 UTC (rev 14491)
+++ trunk/qgis/src/core/qgsvectorfilewriter.cpp	2010-11-02 22:35:52 UTC (rev 14492)
@@ -435,6 +435,16 @@
 
     OGRGeometryH mGeom2 = createEmptyGeometry( geom->wkbType() );
 
+    if ( !mGeom2 )
+    {
+      QgsDebugMsg( QString( "Failed to create empty geometry for type %1 (OGR error: %2)" ).arg( geom->wkbType() ).arg( CPLGetLastErrorMsg() ) );
+      mErrorMessage = QObject::tr( "Feature geometry not imported (OGR error: %1)" )
+                      .arg( QString::fromUtf8( CPLGetLastErrorMsg() ) );
+      mError = ErrFeatureWriteFailed;
+      OGR_F_Destroy( poFeature );
+      return false;
+    }
+
     OGRErr err = OGR_G_ImportFromWkb( mGeom2, geom->asWkb(), geom->wkbSize() );
     if ( err != OGRERR_NONE )
     {



More information about the QGIS-commit mailing list