Skip to content

Commit e295c1f

Browse files
committed
Fix geometry length and area calculation (fix #12827)
1 parent 5462e40 commit e295c1f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/core/geometry/qgsgeos.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,8 @@ double QgsGeos::area() const
270270

271271
try
272272
{
273-
area = GEOSArea_r( geosinit.ctxt, mGeos, &area );
273+
if ( GEOSArea_r( geosinit.ctxt, mGeos, &area ) != 1 )
274+
return -1.0;
274275
}
275276
CATCH_GEOS( -1.0 );
276277
return area;
@@ -285,7 +286,8 @@ double QgsGeos::length() const
285286
}
286287
try
287288
{
288-
length = GEOSLength_r( geosinit.ctxt, mGeos, &length );
289+
if ( GEOSLength_r( geosinit.ctxt, mGeos, &length ) != 1 )
290+
return -1.0;
289291
}
290292
CATCH_GEOS( -1.0 )
291293
return length;

0 commit comments

Comments
 (0)