@@ -633,7 +633,14 @@ bool QgsPointLocator::rebuildIndex( int maxFeaturesToIndex )
633
633
{
634
634
QgsRectangle rect = *mExtent ;
635
635
if ( mTransform )
636
- rect = mTransform ->transformBoundingBox ( rect, QgsCoordinateTransform::ReverseTransform );
636
+ {
637
+ try {
638
+ rect = mTransform ->transformBoundingBox ( rect, QgsCoordinateTransform::ReverseTransform );
639
+ } catch (const QgsException& e) {
640
+ // See http://hub.qgis.org/issues/12634
641
+ QgsDebugMsg ( QString (" could not transform bounding box to map, skipping the snap filter (%1)" ).arg (e.what ()) );
642
+ }
643
+ }
637
644
request.setFilterRect ( rect );
638
645
}
639
646
QgsFeatureIterator fi = mLayer ->getFeatures ( request );
@@ -644,7 +651,15 @@ bool QgsPointLocator::rebuildIndex( int maxFeaturesToIndex )
644
651
continue ;
645
652
646
653
if ( mTransform )
647
- f.geometry ()->transform ( *mTransform );
654
+ {
655
+ try {
656
+ f.geometry ()->transform ( *mTransform );
657
+ } catch (const QgsException& e) {
658
+ // See http://hub.qgis.org/issues/12634
659
+ QgsDebugMsg ( QString (" could not transform geometry to map, skipping the snap for it (%1)" ).arg (e.what ()) );
660
+ continue ;
661
+ }
662
+ }
648
663
649
664
SpatialIndex::Region r ( rect2region ( f.geometry ()->boundingBox () ) );
650
665
dataList << new RTree::Data ( 0 , 0 , r, f.id () );
@@ -708,7 +723,15 @@ void QgsPointLocator::onFeatureAdded( QgsFeatureId fid )
708
723
return ;
709
724
710
725
if ( mTransform )
711
- f.geometry ()->transform ( *mTransform );
726
+ {
727
+ try {
728
+ f.geometry ()->transform ( *mTransform );
729
+ } catch (const QgsException& e) {
730
+ // See http://hub.qgis.org/issues/12634
731
+ QgsDebugMsg ( QString (" could not transform geometry to map, skipping the snap for it (%1)" ).arg (e.what ()) );
732
+ return ;
733
+ }
734
+ }
712
735
713
736
SpatialIndex::Region r ( rect2region ( f.geometry ()->boundingBox () ) );
714
737
mRTree ->insertData ( 0 , 0 , r, f.id () );
0 commit comments