summaryrefslogtreecommitdiff
path: root/src/resources/mapreader.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-08-28 19:31:17 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2008-08-28 19:31:17 +0000
commit9a8456c6c95f5d95c568664ba5adaeb466cfbb0d (patch)
tree701da4a4dd0a8c8f847ba3f8dc3dcca2fa6474b8 /src/resources/mapreader.cpp
parent2e70210586ecc2c201460947802039beb12aa69b (diff)
downloadmana-9a8456c6c95f5d95c568664ba5adaeb466cfbb0d.tar.gz
mana-9a8456c6c95f5d95c568664ba5adaeb466cfbb0d.tar.bz2
mana-9a8456c6c95f5d95c568664ba5adaeb466cfbb0d.tar.xz
mana-9a8456c6c95f5d95c568664ba5adaeb466cfbb0d.zip
Fixed crash when 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 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);
}