Skip to content

Commit 1a72da7

Browse files
author
wonder
committedAug 6, 2010
new labeling: do not crash on invalid geometries
git-svn-id: http://svn.osgeo.org/qgis/trunk@14018 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 9e14a2f commit 1a72da7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed
 

‎src/core/qgspallabeling.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,10 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, const QgsRenderContext
416416
}
417417

418418
QgsGeometry* geom = f.geometry();
419+
GEOSGeometry* geos_geom = geom->asGeos();
420+
if ( geos_geom == NULL )
421+
return; // invalid geometry
422+
419423
if ( ct != NULL ) // reproject the geometry if necessary
420424
geom->transform( *ct );
421425

@@ -424,7 +428,7 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, const QgsRenderContext
424428
return;
425429
}
426430

427-
QgsPalGeometry* lbl = new QgsPalGeometry( f.id(), labelText, GEOSGeom_clone( geom->asGeos() ) );
431+
QgsPalGeometry* lbl = new QgsPalGeometry( f.id(), labelText, GEOSGeom_clone( geos_geom ) );
428432

429433
// record the created geometry - it will be deleted at the end.
430434
geometries.append( lbl );

0 commit comments

Comments
 (0)
Please sign in to comment.