Skip to content

Commit

Permalink
new labeling: do not crash on invalid geometries
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@14018 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Aug 6, 2010
1 parent 9e14a2f commit 1a72da7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/core/qgspallabeling.cpp
Expand Up @@ -416,6 +416,10 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, const QgsRenderContext
}

QgsGeometry* geom = f.geometry();
GEOSGeometry* geos_geom = geom->asGeos();
if ( geos_geom == NULL )
return; // invalid geometry

if ( ct != NULL ) // reproject the geometry if necessary
geom->transform( *ct );

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

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

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

0 comments on commit 1a72da7

Please sign in to comment.