Skip to content

Commit b8706ea

Browse files
committedNov 25, 2015
Fix crash in QgsLineStringV2::append if non z/m line appended
to a LineString with z/m (cherry-picked from ff3657)
1 parent d7bd98a commit b8706ea

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed
 

‎src/core/geometry/qgslinestringv2.cpp

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,28 @@ void QgsLineStringV2::append( const QgsLineStringV2* line )
300300
}
301301

302302
mCoords += line->mCoords;
303-
mZ += line->mZ;
304-
mM += line->mM;
303+
304+
if ( line->is3D() )
305+
{
306+
mZ += line->mZ;
307+
}
308+
else
309+
{
310+
// if append line does not have z coordinates, fill with 0 to match number of points in final line
311+
mZ.insert( mZ.count(), mX.size() - mZ.size(), 0 );
312+
}
313+
314+
if ( line->is3D() )
315+
{
316+
mM += line->mM;
317+
}
318+
else
319+
{
320+
// if append line does not have m values, fill with 0 to match number of points in final line
321+
mM.insert( mM.count(), mX.size() - mM.size(), 0 );
322+
}
323+
324+
mBoundingBox = QgsRectangle(); //set bounding box invalid
305325
}
306326

307327
void QgsLineStringV2::draw( QPainter& p ) const

0 commit comments

Comments
 (0)
Please sign in to comment.