@@ -97,7 +97,7 @@ function cloneCoordSeq(ptr::GEOSCoordSeq, context::GEOSContext = get_global_cont
9797end
9898
9999function destroyCoordSeq (ptr:: GEOSCoordSeq , context:: GEOSContext = get_global_context ())
100- result = GEOSCoordSeq_destroy_r (context, ptr)
100+ o
101101 if result == C_NULL
102102 error (" LibGEOS: Error in GEOSCoordSeq_destroy" )
103103 end
@@ -1306,16 +1306,17 @@ Numbering is one-based.
13061306For a simple geometry, returns a copy of the input.
13071307"""
13081308function getGeometry (obj:: Geometry , n:: Integer , context:: GEOSContext = get_context (obj))
1309- n in 1 : numGeometries (obj, context) || error (
1310- " GEOSGetGeometryN: $(numGeometries (obj, context)) sub-geometries in geom, therefore n should be in 1:$(numGeometries (obj, context)) " ,
1311- )
1309+ n in 1 : numGeometries (obj, context) || _no_n_geom (obj, context, n)
13121310 result = GEOSGetGeometryN_r (context, obj, n - 1 )
13131311 if result == C_NULL
13141312 error (" LibGEOS: Error in GEOSGetGeometryN" )
13151313 end
13161314 geomFromGEOS (cloneGeom (result, context), context)
13171315end
13181316
1317+ @noinline _no_n_geom_error (obj, context, n) =
1318+ erroe (" GEOSGetGeometryN: $(numGeometries (obj, context)) sub-geometries in geom, therefore n: $n should be in 1:$(numGeometries (obj, context)) " ,)
1319+
13191320"""
13201321 getGeometries(obj::Geometry, context::GEOSContext = get_context(obj))
13211322
0 commit comments