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/qgis@14018 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Aug 6, 2010
1 parent ff71ad6 commit f6c132a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/core/qgspallabeling.cpp
Original file line number Diff line number Diff line change
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 f6c132a

Please sign in to comment.