[QGIS Commit] r9089 - trunk/qgis/src/core/spatialindex

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Aug 20 07:36:43 EDT 2008


Author: jef
Date: 2008-08-20 07:36:43 -0400 (Wed, 20 Aug 2008)
New Revision: 9089

Modified:
   trunk/qgis/src/core/spatialindex/qgsspatialindex.cpp
Log:
catch exceptions in QgsSpatialIndex

Modified: trunk/qgis/src/core/spatialindex/qgsspatialindex.cpp
===================================================================
--- trunk/qgis/src/core/spatialindex/qgsspatialindex.cpp	2008-08-20 11:25:42 UTC (rev 9088)
+++ trunk/qgis/src/core/spatialindex/qgsspatialindex.cpp	2008-08-20 11:36:43 UTC (rev 9089)
@@ -19,6 +19,7 @@
 #include "qgsgeometry.h"
 #include "qgsfeature.h"
 #include "qgsrect.h"
+#include "qgslogger.h"
     
 #include "SpatialIndex.h"
 
@@ -89,7 +90,7 @@
 
 bool QgsSpatialIndex::featureInfo(QgsFeature& f, Tools::Geometry::Region& r, long& id)
 {
-  QgsGeometry* g = f.geometry();
+  QgsGeometry *g = f.geometry();
   if (!g)
     return false;
 
@@ -105,8 +106,16 @@
   if (!featureInfo(f, r, id))
     return false;
 
-  // TODO: handle possible exceptions
-  mRTree->insertData(0,0, r, id);
+  // TODO: handle possible exceptions correctly
+  try {
+    mRTree->insertData(0,0, r, id);
+  } catch(Tools::Exception &e) {
+    QgsDebugMsg( QString("Tools::Exception caught: ").arg(e.what().c_str()) );
+  } catch(const std::exception &e) {
+    QgsDebugMsg( QString("std::exception caught: ").arg(e.what()) );
+  } catch(...) {
+    QgsDebugMsg( "unknown spatial index exception caught" );
+  }
 
   return true;
 }



More information about the QGIS-commit mailing list