Skip to content
Permalink
Browse files

catch "feature exists" exception (to avoid crash) in case the provide…

…r goes crazy and returns duplicate feature IDs.

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12207 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed Nov 20, 2009
1 parent b27f88f commit 97987557dd3923d2efd2d579b8bec127d109692f
Showing with 10 additions and 1 deletion.
  1. +10 −1 src/plugins/labeling/pallabeling.cpp
@@ -216,6 +216,7 @@ void LayerSettings::calculateLabelSize( QString text, double& labelX, double& la
labelY = fabs( ptSize.y() - ptZero.y() );
}


void LayerSettings::registerFeature( QgsFeature& f )
{
QString labelText = f.attributeMap()[fieldIndex].toString();
@@ -232,8 +233,16 @@ void LayerSettings::registerFeature( QgsFeature& f )
geometries.append( lbl );

// register feature to the layer
if ( !palLayer->registerFeature( lbl->strId(), lbl, labelX, labelY, labelText.toUtf8().constData() ) )
try
{
if ( !palLayer->registerFeature( lbl->strId(), lbl, labelX, labelY, labelText.toUtf8().constData() ) )
return;
}
catch ( std::exception* e )
{
std::cerr << "Ignoring feature " << f.id() << " due PAL exception: " << e->what() << std::endl;
return;
}

// TODO: only for placement which needs character info
pal::Feature* feat = palLayer->getFeature( lbl->strId() );

0 comments on commit 9798755

Please sign in to comment.