Skip to content

Commit

Permalink
Avoid potential divide by zero
Browse files Browse the repository at this point in the history
(cherry picked from commit 203a253)
  • Loading branch information
nyalldawson committed Jan 29, 2025
1 parent c8f11f2 commit 55d788f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/geometry/qgsinternalgeometryengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -841,9 +841,9 @@ QgsGeometry QgsInternalGeometryEngine::densifyByDistance( double distance ) cons
return QgsGeometry();
}

if ( QgsWkbTypes::geometryType( mGeometry->wkbType() ) == Qgis::GeometryType::Point )
if ( QgsWkbTypes::geometryType( mGeometry->wkbType() ) == Qgis::GeometryType::Point || qgsDoubleNear( distance, 0 ) )
{
return QgsGeometry( mGeometry->clone() ); // point geometry, nothing to do
return QgsGeometry( mGeometry->clone() ); // point geometry (or distance ~= 0), nothing to do
}

if ( const QgsGeometryCollection *gc = qgsgeometry_cast< const QgsGeometryCollection *>( mGeometry ) )
Expand Down

0 comments on commit 55d788f

Please sign in to comment.