Skip to content

Commit

Permalink
fix #2875 digitizing polygon undo crash
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterPetrik committed Oct 25, 2023
1 parent 3dcf1cb commit 70dba7a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app/maptools/recordingmaptool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,14 @@ void RecordingMapTool::removePoint()
mRecordedGeometry.get()->deleteVertex( current );
}

// if this was the last point in the ring and ring is interior
// we remove that ring completely
if ( r->isEmpty() && current.ring > 0 )
// if this was the last point in the ring
// and ring is interior we remove that ring completely
//
// WARNING:
// "r" pointer may be invalid for exterior rings at this point!
// so dereference it only for interior rings
// see https://github.com/MerginMaps/input/issues/2875
if ( current.ring > 0 && r->isEmpty() )
{
QgsCurvePolygon *p = qgsgeometry_cast<QgsCurvePolygon *>( poly );
// rings numerarion starts with 0
Expand Down

0 comments on commit 70dba7a

Please sign in to comment.