[QGIS Commit] r13262 - trunk/qgis/python/plugins/mapserver_export

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Apr 6 11:00:56 EDT 2010


Author: timlinux
Date: 2010-04-06 11:00:55 -0400 (Tue, 06 Apr 2010)
New Revision: 13262

Modified:
   trunk/qgis/python/plugins/mapserver_export/ms_export.py
Log:
Fixed a crash in the plugin that occurs when the epsg code for a layer cannot be parsed

Modified: trunk/qgis/python/plugins/mapserver_export/ms_export.py
===================================================================
--- trunk/qgis/python/plugins/mapserver_export/ms_export.py	2010-04-06 09:52:38 UTC (rev 13261)
+++ trunk/qgis/python/plugins/mapserver_export/ms_export.py	2010-04-06 15:00:55 UTC (rev 13262)
@@ -623,8 +623,12 @@
 
 
   def getEpsg(self, lyr):
-    srs = lyr.getElementsByTagName('srs')[0].getElementsByTagName('spatialrefsys')[0]
-    return srs.getElementsByTagName('epsg')[0].childNodes[0].nodeValue.encode('utf-8')
+    try:
+      srs = lyr.getElementsByTagName('srs')[0].getElementsByTagName('spatialrefsys')[0]
+      return srs.getElementsByTagName('epsg')[0].childNodes[0].nodeValue.encode('utf-8')
+    except:  
+      #Use 4326 as a sensible default if the above fails
+      return "4326"
 
 
   def getPrimaryKey(self, layerId, tableName):



More information about the QGIS-commit mailing list