aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/gob/dataio.cpp3
-rw-r--r--engines/gob/script.cpp5
-rw-r--r--engines/gob/totfile.cpp8
3 files changed, 10 insertions, 6 deletions
diff --git a/engines/gob/dataio.cpp b/engines/gob/dataio.cpp
index 0a0b8b8c49..493da55f45 100644
--- a/engines/gob/dataio.cpp
+++ b/engines/gob/dataio.cpp
@@ -585,6 +585,9 @@ byte *DataIO::getData(const char *path) {
}
DataStream *DataIO::getDataStream(const char *path) {
+ if (!path || (path[0] == '\0') || !existData(path))
+ return 0;
+
uint32 size = getDataSize(path);
byte *data = getData(path);
diff --git a/engines/gob/script.cpp b/engines/gob/script.cpp
index 134ad428ce..d4409b0a4e 100644
--- a/engines/gob/script.cpp
+++ b/engines/gob/script.cpp
@@ -508,10 +508,9 @@ uint16 Script::getFunctionOffset(uint8 function) const {
}
uint32 Script::getVariablesCount(const char *fileName, GobEngine *vm) {
- if (!vm->_dataIO->existData(fileName))
- return 0;
-
DataStream *stream = vm->_dataIO->getDataStream(fileName);
+ if (!stream)
+ return 0;
stream->seek(0x2C);
uint32 variablesCount = stream->readUint32LE();
diff --git a/engines/gob/totfile.cpp b/engines/gob/totfile.cpp
index 2506c00b19..0a955b086d 100644
--- a/engines/gob/totfile.cpp
+++ b/engines/gob/totfile.cpp
@@ -44,9 +44,11 @@ TOTFile::~TOTFile() {
}
bool TOTFile::load(const Common::String &fileName) {
- if (_vm->_dataIO->existData(fileName.c_str()))
- _stream = _vm->_dataIO->getDataStream(fileName.c_str());
- else
+ // Trying to open normally
+ _stream = _vm->_dataIO->getDataStream(fileName.c_str());
+
+ if (!_stream)
+ // Trying to open from video video
_stream = _vm->_vidPlayer->getExtraData(fileName.c_str());
if (!_stream)