Skip to content
Permalink
Browse files

Fix pointsFromWKT to accept only number

  • Loading branch information
lbartoletti committed Aug 24, 2020
1 parent 00b51a1 commit 74984c144c4759151151dcde5302f5ae8ba7c4d3
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/core/geometry/qgsgeometryutils.cpp
@@ -1109,6 +1109,12 @@ QgsPointSequence QgsGeometryUtils::pointsFromWKT( const QString &wktCoordinateLi
for ( const QString &pointCoordinates : coordList )
{
QStringList coordinates = pointCoordinates.split( rx, QString::SkipEmptyParts );

// exit with an empty set if one list contains invalid value.
QRegularExpression rxIsNumber( QStringLiteral( "^[+-]?(\\d\\.?\\d*[Ee][+\\-]?\\d+|(\\d+\\.\\d*|\\d*\\.\\d+)|\\d+)$" ) );
if ( coordinates.filter( rxIsNumber ).size() != coordinates.size() )
return points;

if ( coordinates.size() == 3 && !foundZ && !foundM && !is3D && !isMeasure )
{
// 3 dimensional coordinates, but not specifically marked as such. We allow this

0 comments on commit 74984c1

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