Skip to content

Commit

Permalink
Fix crash in QgsLineStringV2::append if non z/m line appended
Browse files Browse the repository at this point in the history
to a LineString with z/m

(cherry-picked from ff3657)
  • Loading branch information
nyalldawson committed Nov 25, 2015
1 parent d7bd98a commit b8706ea
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/core/geometry/qgslinestringv2.cpp
Expand Up @@ -300,8 +300,28 @@ void QgsLineStringV2::append( const QgsLineStringV2* line )
}

mCoords += line->mCoords;
mZ += line->mZ;
mM += line->mM;

if ( line->is3D() )
{
mZ += line->mZ;
}
else
{
// if append line does not have z coordinates, fill with 0 to match number of points in final line
mZ.insert( mZ.count(), mX.size() - mZ.size(), 0 );
}

if ( line->is3D() )
{
mM += line->mM;
}
else
{
// if append line does not have m values, fill with 0 to match number of points in final line
mM.insert( mM.count(), mX.size() - mM.size(), 0 );
}

mBoundingBox = QgsRectangle(); //set bounding box invalid
}

void QgsLineStringV2::draw( QPainter& p ) const
Expand Down

0 comments on commit b8706ea

Please sign in to comment.