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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Thu Dec 24 11:09:20 EST 2009


Author: jef
Date: 2009-12-24 11:09:19 -0500 (Thu, 24 Dec 2009)
New Revision: 12617

Modified:
   trunk/qgis/src/core/qgsdistancearea.cpp
   trunk/qgis/src/core/qgsgeometry.cpp
Log:
don't measure empty geometries and also return success when exports geos points to wkb

Modified: trunk/qgis/src/core/qgsdistancearea.cpp
===================================================================
--- trunk/qgis/src/core/qgsdistancearea.cpp	2009-12-24 16:02:02 UTC (rev 12616)
+++ trunk/qgis/src/core/qgsdistancearea.cpp	2009-12-24 16:09:19 UTC (rev 12617)
@@ -175,6 +175,9 @@
 
 double QgsDistanceArea::measure( QgsGeometry* geometry )
 {
+  if ( !geometry )
+    return 0.0;
+
   unsigned char* wkb = geometry->asWkb();
   unsigned char* ptr;
   unsigned int wkbType;

Modified: trunk/qgis/src/core/qgsgeometry.cpp
===================================================================
--- trunk/qgis/src/core/qgsgeometry.cpp	2009-12-24 16:02:02 UTC (rev 12616)
+++ trunk/qgis/src/core/qgsgeometry.cpp	2009-12-24 16:09:19 UTC (rev 12617)
@@ -1198,8 +1198,8 @@
   // Bounds checking
   if ( beforeVertex < 0 )
   {
-    ( *new_sequence ) = 0;
-    return FALSE;
+    *new_sequence = 0;
+    return false;
   }
 
   unsigned int numPoints;
@@ -4335,7 +4335,8 @@
       memcpy( mGeometry + 5, &x, sizeof( double ) );
       memcpy( mGeometry + 13, &y, sizeof( double ) );
 
-      break;
+      mDirtyWkb = false;
+      return true;
     } // case GEOS_GEOM::GEOS_POINT
 
     case GEOS_LINESTRING:            // a linestring



More information about the QGIS-commit mailing list