Skip to content

Commit

Permalink
Merge pull request #2876 from MerginMaps/fix_2875_digitizing_poly_crash
Browse files Browse the repository at this point in the history
fix digitizing polygon undo crash
  • Loading branch information
PeterPetrik authored Oct 25, 2023
2 parents a678e1d + 70dba7a commit 79454d8
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 79454d8

Please sign in to comment.