Skip to content
Permalink
Browse files

Fix nasty crash caused by converting MultiLineStrings to GML2

Exporting the geometry to GML2 would corrupt it, causing a
future crash to occur
  • Loading branch information
nyalldawson committed Sep 25, 2017
1 parent 039aff6 commit 6d95ba0a5bef6502c23cb3d8a847346407a4ed48
Showing with 2 additions and 8 deletions.
  1. +2 −8 src/core/geometry/qgsmultilinestring.cpp
@@ -54,15 +54,11 @@ QDomElement QgsMultiLineString::asGML2( QDomDocument &doc, int precision, const
QDomElement elemMultiLineString = doc.createElementNS( ns, QStringLiteral( "MultiLineString" ) );
for ( const QgsAbstractGeometry *geom : mGeometries )
{
if ( qgsgeometry_cast<const QgsLineString *>( geom ) )
if ( const QgsLineString *lineString = qgsgeometry_cast<const QgsLineString *>( geom ) )
{
const QgsLineString *lineString = static_cast<const QgsLineString *>( geom );

QDomElement elemLineStringMember = doc.createElementNS( ns, QStringLiteral( "lineStringMember" ) );
elemLineStringMember.appendChild( lineString->asGML2( doc, precision, ns ) );
elemMultiLineString.appendChild( elemLineStringMember );

delete lineString;
}
}

@@ -74,10 +70,8 @@ QDomElement QgsMultiLineString::asGML3( QDomDocument &doc, int precision, const
QDomElement elemMultiCurve = doc.createElementNS( ns, QStringLiteral( "MultiCurve" ) );
for ( const QgsAbstractGeometry *geom : mGeometries )
{
if ( qgsgeometry_cast<const QgsLineString *>( geom ) )
if ( const QgsLineString *lineString = qgsgeometry_cast<const QgsLineString *>( geom ) )
{
const QgsLineString *lineString = static_cast<const QgsLineString *>( geom );

QDomElement elemCurveMember = doc.createElementNS( ns, QStringLiteral( "curveMember" ) );
elemCurveMember.appendChild( lineString->asGML3( doc, precision, ns ) );
elemMultiCurve.appendChild( elemCurveMember );

0 comments on commit 6d95ba0

Please sign in to comment.
You can’t perform that action at this time.