Skip to content

Commit

Permalink
Return nullptr instead of empty point -- better maintains API compati…
Browse files Browse the repository at this point in the history
…bility with earlier QGIS 3.x releases

Empty points were only introduced recently, and it's possible existing
plugin code may check if the return value is None (not an empty point)
  • Loading branch information
nyalldawson committed Feb 8, 2021
1 parent e3be840 commit 8730268
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/geometry/qgsgeos.cpp
Expand Up @@ -1112,7 +1112,8 @@ std::unique_ptr<QgsAbstractGeometry> QgsGeos::fromGeos( const GEOSGeometry *geos
case GEOS_POINT: // a point
{
if ( GEOSisEmpty_r( geosinit()->ctxt, geos ) )
return qgis::make_unique< QgsPoint >();
return nullptr;

const GEOSCoordSequence *cs = GEOSGeom_getCoordSeq_r( geosinit()->ctxt, geos );
unsigned int nPoints = 0;
GEOSCoordSeq_getSize_r( geosinit()->ctxt, cs, &nPoints );
Expand Down

0 comments on commit 8730268

Please sign in to comment.