summaryrefslogtreecommitdiff
path: root/src/resources/mapreader.cpp
diff options
context:
space:
mode:
authorLloyd Bryant <lloyd_bryant@netzero.net>2008-08-29 01:36:21 +0000
committerLloyd Bryant <lloyd_bryant@netzero.net>2008-08-29 01:36:21 +0000
commitaf742ceb85512edd1d6883a5ea4f4188e64725be (patch)
tree0772f1ec5a8c741337c5232669ea1454f735fb23 /src/resources/mapreader.cpp
parentb16c29acb5d625df121f5c6aa8ea60a2943845c9 (diff)
downloadmana-af742ceb85512edd1d6883a5ea4f4188e64725be.tar.gz
mana-af742ceb85512edd1d6883a5ea4f4188e64725be.tar.bz2
mana-af742ceb85512edd1d6883a5ea4f4188e64725be.tar.xz
mana-af742ceb85512edd1d6883a5ea4f4188e64725be.zip
Added fix from TMW to prevent crash if a map layer has too many tiles
Diffstat (limited to 'src/resources/mapreader.cpp')
-rw-r--r--src/resources/mapreader.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 3dbaefde..e2b47e66 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -378,7 +378,13 @@ MapReader::readLayer(xmlNodePtr node, Map *map, int layer)
map->setTileWithGid(x, y, layer, 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);
}