summaryrefslogtreecommitdiff
path: root/src/resources/mapreader.cpp
diff options
context:
space:
mode:
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);
}