Skip to content
Permalink
Browse files

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

  • Loading branch information
nyalldawson committed Jun 2, 2020
1 parent 3aa5e56 commit 2f9e57d50a322adbfe9af1e4bd01cf702073dece
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>
@@ -202,9 +203,17 @@ bool Layer::registerFeature( QgsLabelFeature *lf )
{
geos::unique_ptr geom = QgsGeos::asGeos( *it );

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.get() ) != 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 2f9e57d

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