[geos-commits] r3013 - trunk/src/linearref

svn_geos at osgeo.org svn_geos at osgeo.org
Sat Jun 19 07:16:26 EDT 2010


Author: strk
Date: 2010-06-19 11:16:26 +0000 (Sat, 19 Jun 2010)
New Revision: 3013

Modified:
   trunk/src/linearref/LinearIterator.cpp
Log:
Throw an exception on first non-linestring component, rather than segfaulting la
ter... (might be better to refuse non-lineal even earlier, but this way we *migh
* be supporting collections with only linestrings)


Modified: trunk/src/linearref/LinearIterator.cpp
===================================================================
--- trunk/src/linearref/LinearIterator.cpp	2010-06-19 11:14:21 UTC (rev 3012)
+++ trunk/src/linearref/LinearIterator.cpp	2010-06-19 11:16:26 UTC (rev 3013)
@@ -23,6 +23,7 @@
 #include <geos/linearref/LinearIterator.h>
 #include <geos/linearref/LinearLocation.h>
 #include <geos/linearref/LengthLocationMap.h>
+#include <geos/util/IllegalArgumentException.h>
 
 using namespace geos::geom;
 
@@ -74,6 +75,9 @@
 		return;
 	}
 	currentLine = dynamic_cast<const LineString *> (linear->getGeometryN(componentIndex));
+	if ( ! currentLine ) {
+		throw util::IllegalArgumentException("computed index is before specified minimum index");
+	}
 }
 
 bool LinearIterator::hasNext() const



More information about the geos-commits mailing list