]> granicus.if.org Git - postgis/commitdiff
Gracefully handle short-measure issue (Closes #3845)
authorPaul Ramsey <pramsey@cleverelephant.ca>
Mon, 2 Oct 2017 12:51:58 +0000 (12:51 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Mon, 2 Oct 2017 12:51:58 +0000 (12:51 +0000)
git-svn-id: http://svn.osgeo.org/postgis/branches/2.4@15872 b70326c6-7e19-0410-871a-916f4a2858ee

NEWS
liblwgeom/lwlinearreferencing.c

diff --git a/NEWS b/NEWS
index 32a39f49e6cd34df399c2a9d1e858ee45dd2bd16..4b589491a024177deae1097b23d38621f716c7b3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ YYYY/MM/DD
  * Bug fixes *
   - #3864, Fix memory leaks in BTREE operators
   - #3869, Fix build with "gold" linker
+  - #3845, Gracefully handle short-measure issue
 
 PostGIS 2.4.0
 2017/09/30
index fdd8c6301fd85e8828aacd990f6aa96191828325..5cb81bb21dfc5dbae1c5b99f4aa8a23e2b5fc1bb 100644 (file)
@@ -50,14 +50,15 @@ segment_locate_along(const POINT4D *p1, const POINT4D *p2, double m, double offs
                        *pn = *p1;
                        return LW_TRUE;
                }
-               /* If the points are different we can out.
-                  Correct behavior is probably an mprop of 0.5? */
-               lwerror("Zero measure-length line encountered!");
-               return LW_FALSE;
+               /* If the points are different we split the difference */
+               mprop = 0.5;
+       }
+       else
+       {
+               mprop = (m - m1) / (m2 - m1);
        }
 
        /* M is in range, new point to be generated. */
-       mprop = (m - m1) / (m2 - m1);
        pn->x = p1->x + (p2->x - p1->x) * mprop;
        pn->y = p1->y + (p2->y - p1->y) * mprop;
        pn->z = p1->z + (p2->z - p1->z) * mprop;