Skip to content

Commit

Permalink
Fixes a crash when adding a single point to multi
Browse files Browse the repository at this point in the history
Fixes #45152
  • Loading branch information
elpaso authored and nyalldawson committed Sep 27, 2021
1 parent 53fcebc commit 157c489
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/gui/qgsmaptooldigitizefeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,12 @@ void QgsMapToolDigitizeFeature::cadCanvasReleaseEvent( QgsMapMouseEvent *e )

if ( res == 0 )
{
savePoint = QgsPoint( layerWKBType, fetchPoint.x(), fetchPoint.y(), fetchPoint.z(), fetchPoint.m() );
savePoint = QgsPoint( QgsWkbTypes::singleType( layerWKBType ), fetchPoint.x(), fetchPoint.y(), fetchPoint.z(), fetchPoint.m() );
}
else
{
const QgsPointXY layerPoint = toLayerCoordinates( vlayer, e->mapPoint() );
savePoint = QgsPoint( layerWKBType, layerPoint.x(), layerPoint.y(), fetchPoint.z(), fetchPoint.m() );
savePoint = QgsPoint( QgsWkbTypes::singleType( layerWKBType ), layerPoint.x(), layerPoint.y(), fetchPoint.z(), fetchPoint.m() );
}
}
catch ( QgsCsException &cse )
Expand All @@ -189,7 +189,7 @@ void QgsMapToolDigitizeFeature::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
QgsFeature f( vlayer->fields() );

QgsGeometry g;
const QgsPoint result( layerWKBType, savePoint.x(), savePoint.y(), isMatchPointZ ? savePoint.z() : defaultZValue(), isMatchPointM ? savePoint.m() : defaultMValue() );
const QgsPoint result( QgsWkbTypes::singleType( layerWKBType ), savePoint.x(), savePoint.y(), isMatchPointZ ? savePoint.z() : defaultZValue(), isMatchPointM ? savePoint.m() : defaultMValue() );
if ( mCheckGeometryType == false )
{
// if layer supports more types (mCheckGeometryType is false)
Expand Down

0 comments on commit 157c489

Please sign in to comment.