summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--src/resources/mapreader.cpp8
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 580fbca7..70ae300b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,6 +17,8 @@
works around an initialization bug.
* data/help/index.txt, data/help/windows.txt: Included some
documentation for the shortcut window by Vq.
+ * src/resources/mapreader.cpp: Fixed crash when map layer has too many
+ tiles.
2008-08-28 Philipp Sehmisch <tmw@crushnet.org>
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 328b66e0..af3fc0ef 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -407,7 +407,13 @@ MapReader::readLayer(xmlNodePtr node, Map *map)
setTile(map, layer, x, y, gid);
x++;
- if (x == w) {x = 0; y++;}
+ if (x == w) {
+ x = 0; y++;
+
+ // When we're done, don't crash on too much data
+ if (y == h)
+ break;
+ }
}
free(binData);
}