diff options
-rw-r--r-- | engines/wage/design.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp index 6c8fa7fa3c..a5d217b9bd 100644 --- a/engines/wage/design.cpp +++ b/engines/wage/design.cpp @@ -395,7 +395,7 @@ void Design::drawBitmap(Graphics::Surface *surface, Common::ReadStream &in, bool numBytes -= 10; int x = 0, y = 0; - while (numBytes > 0) { + while (numBytes > 0 && y < h) { int n = in.readSByte(); int count; int b; @@ -415,7 +415,7 @@ void Design::drawBitmap(Graphics::Surface *surface, Common::ReadStream &in, bool count = 0; } - for (int i = 0; i < count; i++) { + for (int i = 0; i < count && y < h; i++) { byte color; if (state == 1) { color = in.readByte(); @@ -439,13 +439,7 @@ void Design::drawBitmap(Graphics::Surface *surface, Common::ReadStream &in, bool break; } } - - if (y == h) - break; } - - if (y == h) - break; } while (numBytes--) |