Skip to content

Commit

Permalink
catch "feature exists" exception (to avoid crash) in case the provide…
Browse files Browse the repository at this point in the history
…r goes crazy and returns duplicate feature IDs.

git-svn-id: http://svn.osgeo.org/qgis/trunk@12207 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Nov 20, 2009
1 parent 04c2a50 commit 79eaa5a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/plugins/labeling/pallabeling.cpp
Expand Up @@ -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();
Expand All @@ -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() );
Expand Down

0 comments on commit 79eaa5a

Please sign in to comment.