summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tileset.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tileset.py b/src/tileset.py
index 244cf8e..2528d8a 100644
--- a/src/tileset.py
+++ b/src/tileset.py
@@ -155,7 +155,7 @@ class KPTileObject(object):
# Paint the mainblock
for row in h:
for tile in w:
- if (tile == (row * self.width) + offset):
+ if (tile == (row * self.width) + offset) and offset < self.width:
buf[row][tile] = mainblock[offset]
offset += 1
offset = 0
@@ -163,7 +163,7 @@ class KPTileObject(object):
# Paint the subblock
for row in h:
for tile in w:
- if (tile == ((row - 1) * self.width) + offset):
+ if (tile == ((row - 1) * self.width) + offset) and offset < self.width:
buf[row][tile] = mainblock[offset]
offset += 1
offset = 0