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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Fri Aug 6 09:29:03 EDT 2010


Author: wonder
Date: 2010-08-06 13:29:03 +0000 (Fri, 06 Aug 2010)
New Revision: 14018

Modified:
   trunk/qgis/src/core/qgspallabeling.cpp
Log:
new labeling: do not crash on invalid geometries


Modified: trunk/qgis/src/core/qgspallabeling.cpp
===================================================================
--- trunk/qgis/src/core/qgspallabeling.cpp	2010-08-06 12:37:49 UTC (rev 14017)
+++ trunk/qgis/src/core/qgspallabeling.cpp	2010-08-06 13:29:03 UTC (rev 14018)
@@ -416,6 +416,10 @@
   }
 
   QgsGeometry* geom = f.geometry();
+  GEOSGeometry* geos_geom = geom->asGeos();
+  if ( geos_geom == NULL )
+    return; // invalid geometry
+
   if ( ct != NULL ) // reproject the geometry if necessary
     geom->transform( *ct );
 
@@ -424,7 +428,7 @@
     return;
   }
 
-  QgsPalGeometry* lbl = new QgsPalGeometry( f.id(), labelText, GEOSGeom_clone( geom->asGeos() ) );
+  QgsPalGeometry* lbl = new QgsPalGeometry( f.id(), labelText, GEOSGeom_clone( geos_geom ) );
 
   // record the created geometry - it will be deleted at the end.
   geometries.append( lbl );



More information about the QGIS-commit mailing list