aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlyssa Milburn2010-11-30 00:11:15 +0000
committerAlyssa Milburn2010-11-30 00:11:15 +0000
commit39532b0eca5c526c34db2311553dca1bc160bc90 (patch)
treec020d8aa3330b2d750abb0510e8ce73d551aaa5e
parent99264d47c3ed8b0914c9141a81c8c34aabb1823a (diff)
downloadscummvm-rg350-39532b0eca5c526c34db2311553dca1bc160bc90.tar.gz
scummvm-rg350-39532b0eca5c526c34db2311553dca1bc160bc90.tar.bz2
scummvm-rg350-39532b0eca5c526c34db2311553dca1bc160bc90.zip
MOHAWK: don't try reading non-existent messages
svn-id: r54661
-rw-r--r--engines/mohawk/livingbooks.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp
index 0c5d7c1575..72c24afa38 100644
--- a/engines/mohawk/livingbooks.cpp
+++ b/engines/mohawk/livingbooks.cpp
@@ -1470,15 +1470,15 @@ void LBItem::readFrom(Common::SeekableSubReadStreamEndian *stream) {
error("Item is larger (should end at %d) than stream (size %d)", endPos, stream->size());
while (true) {
+ if (stream->pos() == endPos)
+ break;
+
uint16 dataType = stream->readUint16();
uint16 dataSize = stream->readUint16();
debug(4, "Data type %04x, size %d", dataType, dataSize);
readData(dataType, dataSize, stream);
- if (stream->pos() == endPos)
- break;
-
if (stream->pos() > endPos)
error("Read off the end (at %d) of data (ends at %d)", stream->pos(), endPos);