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