http://code.google.com/p/labyrinth/source/detail?r=354
Modified:
/trunk/ChangeLog
/trunk/src/MapList.py
=======================================
--- /trunk/ChangeLog Sat Apr 23 07:28:34 2011
+++ /trunk/ChangeLog Sat Apr 23 07:36:47 2011
@@ -1,3 +1,8 @@
+2011-04-23 Matthias Vogelgesang <matthias.v...@gmail.com>
+
+ * src/MapList.py
+ Fix issue 148 with Patch from "perlhead"
+
2011-04-23 Matthias Vogelgesang <matthias.v...@gmail.com>
* src/*.py
=======================================
--- /trunk/src/MapList.py Sat Apr 23 07:28:34 2011
+++ /trunk/src/MapList.py Sat Apr 23 07:36:47 2011
@@ -26,6 +26,7 @@
import gtk
import xml.dom.minidom as dom
import datetime
+from xml.parsers.expat import ExpatError
class MapList(object):
COL_ID = 0
@@ -106,10 +107,13 @@
def new_from_file(cls, filename):
index = len(cls._maps)
map = cls.MapCore(index = index)
- cls._maps.append(map)
- map.modtime =
datetime.datetime.fromtimestamp(os.stat(filename)[8]).strftime("%x %X")
- cls.tree_view_model.append([map.index, map.title, map.modtime,
map.filename, False])
- map._read_from_file(filename)
+ try:
+ map._read_from_file(filename)
+ cls._maps.append(map)
+ map.modtime =
datetime.datetime.fromtimestamp(os.stat(filename)[8]).strftime("%x %X")
+ cls.tree_view_model.append([map.index, map.title, map.modtime,
map.filename, False])
+ except ExpatError:
+ map = None
return map
@classmethod