diff options
-rw-r--r-- | engines/sci/engine/savegame.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 072c4db57b..3ced5a4f9d 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -411,15 +411,19 @@ void Script::syncStringHeap(Common::Serializer &s) { do { int blockType = READ_LE_UINT16(buf); - int blockSize = READ_LE_UINT16(buf + 2); - assert(blockSize > 0); - + int blockSize; if (blockType == 0) break; + + blockSize = READ_LE_UINT16(buf + 2); + assert(blockSize > 0); + + if (blockType == SCI_OBJ_STRINGS) s.syncBytes(buf, blockSize); buf += blockSize; + if (_buf - buf == 0) break; } while (1); |