Skip to content
Permalink
Browse files

Be super cautious and just log errors when pal obstacle geometry is null

(cherry picked from commit cfe335c)
  • Loading branch information
nyalldawson committed Jun 3, 2020
1 parent a22635b commit 724f84db4941a78c75c183020ef9761b514e2512
Showing with 9 additions and 0 deletions.
  1. +9 −0 src/core/pal/layer.cpp
@@ -35,6 +35,7 @@
#include "geomfunction.h"
#include "util.h"
#include "qgslabelingengine.h"
#include "qgslogger.h"

#include <cmath>
#include <vector>
@@ -212,9 +213,17 @@ bool Layer::registerFeature( QgsLabelFeature *lf )
{
const GEOSGeometry *geom = simpleGeometries->takeFirst();

if ( !geom )
{
QgsDebugMsg( QStringLiteral( "Obstacle geometry passed to PAL labeling engine could not be converted to GEOS! %1" ).arg( ( *it )->asWkt() ) );
continue;
}

// ignore invalid geometries (e.g. polygons with self-intersecting rings)
if ( GEOSisValid_r( geosctxt, geom ) != 1 ) // 0=invalid, 1=valid, 2=exception
{
// this shouldn't happen -- we have already checked this while registering the feature
QgsDebugMsg( QStringLiteral( "Obstacle geometry passed to PAL labeling engine is not valid! %1" ).arg( ( *it )->asWkt() ) );
continue;
}

0 comments on commit 724f84d

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