aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-20 21:53:10 -0400
committerPaul Gilbert2016-08-20 21:53:10 -0400
commitbad86050148fc4debfce6bac2e56910a53a9785d (patch)
tree52dd887a636085c92027fddd17a4145f4c8cad8b
parentca07e26f9e31a59f1c6862db7de7a40a8ba50d94 (diff)
downloadscummvm-rg350-bad86050148fc4debfce6bac2e56910a53a9785d.tar.gz
scummvm-rg350-bad86050148fc4debfce6bac2e56910a53a9785d.tar.bz2
scummvm-rg350-bad86050148fc4debfce6bac2e56910a53a9785d.zip
TITANIC: Fix opening empty resources from the DAT file
-rw-r--r--engines/titanic/support/files_manager.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/engines/titanic/support/files_manager.cpp b/engines/titanic/support/files_manager.cpp
index 04928b96d6..89e0a1d10e 100644
--- a/engines/titanic/support/files_manager.cpp
+++ b/engines/titanic/support/files_manager.cpp
@@ -21,6 +21,7 @@
*/
#include "common/file.h"
+#include "common/memstream.h"
#include "titanic/support/files_manager.h"
#include "titanic/game_manager.h"
@@ -51,7 +52,7 @@ void CFilesManager::loadResourceIndex() {
for (;;) {
offset = _datFile.readUint32LE();
size = _datFile.readUint32LE();
- if (size == 0)
+ if (offset == 0 && size == 0)
break;
Common::String resName;
@@ -126,7 +127,8 @@ Common::SeekableReadStream *CFilesManager::getResource(const CString &str) {
ResourceEntry resEntry = _resources[str];
_datFile.seek(resEntry._offset);
- return _datFile.readStream(resEntry._size);
+ return (resEntry._size > 0) ? _datFile.readStream(resEntry._size) :
+ new Common::MemoryReadStream(nullptr, 0);
}
} // End of namespace Titanic