[Thuban-commits] r2800 - in trunk/thuban: . libraries/thuban

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Jan 8 16:55:21 CET 2008


Author: bernhard
Date: 2008-01-08 16:55:20 +0100 (Tue, 08 Jan 2008)
New Revision: 2800

Modified:
   trunk/thuban/ChangeLog
   trunk/thuban/libraries/thuban/wxproj.cpp
Log:
* libraries/thuban/wxproj.cpp(project_points): made function robust
against being called with no points. (also fixes main defect related 
to [#571] (MemoryError when adding a particular shp layer))


Modified: trunk/thuban/ChangeLog
===================================================================
--- trunk/thuban/ChangeLog	2008-01-03 00:49:09 UTC (rev 2799)
+++ trunk/thuban/ChangeLog	2008-01-08 15:55:20 UTC (rev 2800)
@@ -1,3 +1,9 @@
+2008-01-08   Bernhard Reiter <bernhard at intevation.de>
+
+	* libraries/thuban/wxproj.cpp(project_points): made function robust
+	against being called with no points. (also fixes main defect related 
+	to [#571] (MemoryError when adding a particular shp layer))
+
 2007-12-09   Bernhard Reiter <bernhard at intevation.de>
 
 	WMS Extention improvements: Better logging for problem analysis. 

Modified: trunk/thuban/libraries/thuban/wxproj.cpp
===================================================================
--- trunk/thuban/libraries/thuban/wxproj.cpp	2008-01-03 00:49:09 UTC (rev 2799)
+++ trunk/thuban/libraries/thuban/wxproj.cpp	2008-01-08 15:55:20 UTC (rev 2800)
@@ -185,6 +185,8 @@
 {
     int i;
     int num_points = num_vertices + num_parts - 1;
+    if (num_points <= 0) return NULL;
+
     wxPoint* points = (wxPoint*)malloc(num_points * sizeof(wxPoint));
     if (!points)
     {
@@ -261,6 +263,7 @@
     PyObject * py_dc;
     double scalex, scaley, offx, offy;
 
+    /*printf("draw_polygon_init() called\n");*/
     if (!PyArg_ParseTuple(args, "OOOOdddd",
 			  &py_shapefile,
                           &py_dc, &py_forward, &py_inverse,



More information about the Thuban-commits mailing list