Skip to content

Commit

Permalink
Fixed a crash in the plugin that occurs when the epsg code for a laye…
Browse files Browse the repository at this point in the history
…r cannot be parsed

git-svn-id: http://svn.osgeo.org/qgis/trunk@13262 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Apr 6, 2010
1 parent 8eb0318 commit 243e766
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions python/plugins/mapserver_export/ms_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,8 +623,12 @@ def writeMapLayers(self):


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):
Expand Down

0 comments on commit 243e766

Please sign in to comment.