Do not rely on out param value in getNodeWithinDistance2D callback
authorSandro Santilli <strk@keybit.net>
Mon, 29 Jun 2015 07:02:04 +0000 (07:02 +0000)
committerSandro Santilli <strk@keybit.net>
Mon, 29 Jun 2015 07:02:04 +0000 (07:02 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@13734 b70326c6-7e19-0410-871a-916f4a2858ee

topology/postgis_topology.c

index a0e120d06693396f41f1eebdc954ce98f3cf505a..007757d90e45141aa360810ef88ace40d760e6c3 100644 (file)
@@ -515,7 +515,7 @@ cb_getNodeWithinDistance2D(const LWT_BE_TOPOLOGY* topo,
   } else if ( elems_requested > 0 ) {
     appendStringInfo(sql, " LIMIT %d", elems_requested);
   }
-  spi_result = SPI_execute(sql->data, true, *numelems);
+  spi_result = SPI_execute(sql->data, true, limit >= 0 ? limit : 0);
   if ( spi_result != SPI_OK_SELECT ) {
                cberror(topo->be_data, "unexpected return (%d) from query execution: %s",
             spi_result, sql->data);
@@ -523,7 +523,7 @@ cb_getNodeWithinDistance2D(const LWT_BE_TOPOLOGY* topo,
   }
   pfree(sqldata.data);
 
-  lwpgnotice("cb_getNodeWithinDistance2D: edge query "
+  lwpgnotice("cb_getNodeWithinDistance2D: node query "
              "(limited by %d) returned %d rows",
              elems_requested, SPI_processed);
   if ( ! SPI_processed ) {