From 8f7f1df552062a4fd3b5525f7a75ec3fc898514d Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Wed, 23 Sep 2015 18:31:23 +0000 Subject: [PATCH] #3283, be less brittle in cases of box-overlap-but-geom-not git-svn-id: http://svn.osgeo.org/postgis/trunk@14089 b70326c6-7e19-0410-871a-916f4a2858ee --- liblwgeom/lwlinearreferencing.c | 34 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/liblwgeom/lwlinearreferencing.c b/liblwgeom/lwlinearreferencing.c index 6c745fa9c..b702292ba 100644 --- a/liblwgeom/lwlinearreferencing.c +++ b/liblwgeom/lwlinearreferencing.c @@ -1302,26 +1302,24 @@ lwgeom_cpa_within(const LWGEOM *g1, const LWGEOM *g2, double maxdist) if ( nmvals < 2 ) { + /* there's a single time, must be that one... */ + double t0 = mvals[0]; + POINT4D p0, p1; + LWDEBUGF(1, "Inputs only exist both at a single time (%g)", t0); + if ( -1 == ptarray_locate_along_linear(l1->points, t0, &p0, 0) ) { - /* there's a single time, must be that one... */ - double t0 = mvals[0]; - POINT4D p0, p1; - LWDEBUGF(1, "Inputs only exist both at a single time (%g)", t0); - if ( -1 == ptarray_locate_along_linear(l1->points, t0, &p0, 0) ) - { - lwerror("Could not find point with M=%g on first geom", t0); - return -1; - } - if ( -1 == ptarray_locate_along_linear(l2->points, t0, &p1, 0) ) - { - lwerror("Could not find point with M=%g on second geom", t0); - return -1; - } - if ( distance3d_pt_pt((POINT3D*)&p0, (POINT3D*)&p1) <= maxdist ) - within = LW_TRUE; - lwfree(mvals); - return within; + lwnotice("Could not find point with M=%g on first geom", t0); + return LW_FALSE; } + if ( -1 == ptarray_locate_along_linear(l2->points, t0, &p1, 0) ) + { + lwnotice("Could not find point with M=%g on second geom", t0); + return LW_FALSE; + } + if ( distance3d_pt_pt((POINT3D*)&p0, (POINT3D*)&p1) <= maxdist ) + within = LW_TRUE; + lwfree(mvals); + return within; } /* -- 2.50.0