Skip to content

Commit 2dc40ae

Browse files
szekerestnyalldawson
authored andcommitted
Fix compoundcurve parser
1 parent 68a5d1a commit 2dc40ae

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/providers/mssql/qgsmssqlgeometryparser.cpp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -467,11 +467,13 @@ std::unique_ptr< QgsCompoundCurve > QgsMssqlGeometryParser::readCompoundCurve( i
467467
switch ( SegmentType( mSegment ) )
468468
{
469469
case SMT_FIRSTLINE:
470-
if ( isCurve )
471-
poCompoundCurve->addCurve( readCircularString( iPoint - nPointsPrepared, iPoint + 1 ).release() );
472-
else
473-
poCompoundCurve->addCurve( readLineString( iPoint - nPointsPrepared, iPoint + 1 ).release() );
474-
470+
if (nPointsPrepared > 0)
471+
{
472+
if ( isCurve )
473+
poCompoundCurve->addCurve( readCircularString( iPoint - nPointsPrepared, iPoint + 1 ).release() );
474+
else
475+
poCompoundCurve->addCurve( readLineString( iPoint - nPointsPrepared, iPoint + 1 ).release() );
476+
}
475477
isCurve = false;
476478
nPointsPrepared = 1;
477479
++iPoint;
@@ -481,11 +483,13 @@ std::unique_ptr< QgsCompoundCurve > QgsMssqlGeometryParser::readCompoundCurve( i
481483
++iPoint;
482484
break;
483485
case SMT_FIRSTARC:
484-
if ( isCurve )
485-
poCompoundCurve->addCurve( readCircularString( iPoint - nPointsPrepared, iPoint + 1 ).release() );
486-
else
487-
poCompoundCurve->addCurve( readLineString( iPoint - nPointsPrepared, iPoint + 1 ).release() );
488-
486+
if ( nPointsPrepared > 0 )
487+
{
488+
if ( isCurve )
489+
poCompoundCurve->addCurve( readCircularString( iPoint - nPointsPrepared, iPoint + 1 ).release() );
490+
else
491+
poCompoundCurve->addCurve( readLineString( iPoint - nPointsPrepared, iPoint + 1 ).release() );
492+
}
489493
isCurve = true;
490494
nPointsPrepared = 2;
491495
iPoint += 2;

0 commit comments

Comments
 (0)