Skip to content

Commit

Permalink
Check if a point is 3D before returning its z value. Fixes #37772
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Sep 28, 2020
1 parent 8d2a0d1 commit d1d1569
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/core/expression/qgsexpressionfunction.cpp
Expand Up @@ -2349,6 +2349,9 @@ static QVariant fcnGeomZ( const QVariantList &values, const QgsExpressionContext
if ( geom.isNull() )
return QVariant(); //or 0?

if ( !geom.constGet()->is3D() )
return QVariant();

//if single point, return the point's z coordinate
if ( geom.type() == QgsWkbTypes::PointGeometry && !geom.isMultipart() )
{
Expand Down

0 comments on commit d1d1569

Please sign in to comment.