[geos-commits] r2650 - trunk/source/operation/buffer

svn_geos at osgeo.org svn_geos at osgeo.org
Thu Oct 1 06:30:22 EDT 2009


Author: strk
Date: 2009-10-01 06:30:20 -0400 (Thu, 01 Oct 2009)
New Revision: 2650

Modified:
   trunk/source/operation/buffer/BufferBuilder.cpp
Log:
Throw an exception rather than returning NULL if input to single-sided buffer code is invalid


Modified: trunk/source/operation/buffer/BufferBuilder.cpp
===================================================================
--- trunk/source/operation/buffer/BufferBuilder.cpp	2009-10-01 09:10:08 UTC (rev 2649)
+++ trunk/source/operation/buffer/BufferBuilder.cpp	2009-10-01 10:30:20 UTC (rev 2650)
@@ -47,6 +47,7 @@
 #include <geos/geomgraph/Node.h>
 #include <geos/geomgraph/Edge.h>
 #include <geos/util/GEOSException.h>
+#include <geos/util/IllegalArgumentException.h>
 #include <geos/profiler.h>
 
 #include <cassert>
@@ -117,7 +118,7 @@
    // Returns the line used to create a single-sided buffer.
    // Input requirement: Must be a LineString.
    const LineString* l = dynamic_cast< const LineString* >( g );
-   if ( !l ) return NULL;
+   if ( !l ) throw util::IllegalArgumentException("BufferBuilder::bufferLineSingleSided only accept linestrings");
 
    // Get geometry factory and precision model.
    const PrecisionModel* precisionModel = workingPrecisionModel;



More information about the geos-commits mailing list