Commit 5430d551 authored by Paul Ramsey's avatar Paul Ramsey

lwpoly_construct_circle: Avoid division by zero (Raúl Marín Rodríguez)

Closes #4003
Closes #199


git-svn-id: http://svn.osgeo.org/postgis/trunk@16364 b70326c6-7e19-0410-871a-916f4a2858ee
parent f16a308e
Pipeline #16678944 passed with stage
in 16 minutes and 13 seconds
......@@ -120,13 +120,13 @@ LWPOLY*
lwpoly_construct_circle(int srid, double x, double y, double radius, uint32_t segments_per_quarter, char exterior)
{
const uint32_t segments = 4*segments_per_quarter;
const double theta = 2*M_PI / segments;
double theta;
LWPOLY *lwpoly;
POINTARRAY *pa;
POINT4D pt;
uint32_t i;
if (segments_per_quarter < 1)
if (segments_per_quarter == 0)
{
lwerror("Need at least one segment per quarter-circle.");
return NULL;
......@@ -138,6 +138,8 @@ lwpoly_construct_circle(int srid, double x, double y, double radius, uint32_t se
return NULL;
}
theta = 2*M_PI / segments;
lwpoly = lwpoly_construct_empty(srid, LW_FALSE, LW_FALSE);
pa = ptarray_construct_empty(LW_FALSE, LW_FALSE, segments + 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment