Skip to content

Commit

Permalink
Fix crash when calling equality operator on QgsCircularString
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 19, 2017
1 parent 3d0d7aa commit e937782
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/core/geometry/qgscircularstring.cpp
Expand Up @@ -38,7 +38,26 @@ bool QgsCircularString::operator==( const QgsCurve &other ) const
if ( !otherLine )
return false;

return *otherLine == *this;
if ( mWkbType != otherLine->mWkbType )
return false;

if ( mX.count() != otherLine->mX.count() )
return false;

for ( int i = 0; i < mX.count(); ++i )
{
if ( !qgsDoubleNear( mX.at( i ), otherLine->mX.at( i ) )
|| !qgsDoubleNear( mY.at( i ), otherLine->mY.at( i ) ) )
return false;

if ( is3D() && !qgsDoubleNear( mZ.at( i ), otherLine->mZ.at( i ) ) )
return false;

if ( isMeasure() && !qgsDoubleNear( mM.at( i ), otherLine->mM.at( i ) ) )
return false;
}

return true;
}

bool QgsCircularString::operator!=( const QgsCurve &other ) const
Expand Down

0 comments on commit e937782

Please sign in to comment.