Skip to content

Commit 79eaa5a

Browse files
author
wonder
committed
catch "feature exists" exception (to avoid crash) in case the provider goes crazy and returns duplicate feature IDs.
git-svn-id: http://svn.osgeo.org/qgis/trunk@12207 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 04c2a50 commit 79eaa5a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/plugins/labeling/pallabeling.cpp

+10-1
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ void LayerSettings::calculateLabelSize( QString text, double& labelX, double& la
216216
labelY = fabs( ptSize.y() - ptZero.y() );
217217
}
218218

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

234235
// register feature to the layer
235-
if ( !palLayer->registerFeature( lbl->strId(), lbl, labelX, labelY, labelText.toUtf8().constData() ) )
236+
try
237+
{
238+
if ( !palLayer->registerFeature( lbl->strId(), lbl, labelX, labelY, labelText.toUtf8().constData() ) )
239+
return;
240+
}
241+
catch ( std::exception* e )
242+
{
243+
std::cerr << "Ignoring feature " << f.id() << " due PAL exception: " << e->what() << std::endl;
236244
return;
245+
}
237246

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

0 commit comments

Comments
 (0)