aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/support/simple_file.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/engines/titanic/support/simple_file.cpp b/engines/titanic/support/simple_file.cpp
index 7e3cea35be..65d2c85273 100644
--- a/engines/titanic/support/simple_file.cpp
+++ b/engines/titanic/support/simple_file.cpp
@@ -467,7 +467,7 @@ void SimpleFile::skipSpaces() {
/*------------------------------------------------------------------------*/
bool StdCWadFile::open(const Common::String &filename) {
- File f;
+ Common::File f;
CString name = filename;
// Check for whether it is indeed a file/resource pair
@@ -476,9 +476,11 @@ bool StdCWadFile::open(const Common::String &filename) {
if (idx < 0) {
// Nope, so open up file for standard reading
assert(!name.empty());
- f.open(name);
+ if (!f.open(name))
+ return false;
SimpleFile::open(f.readStream(f.size()));
+ f.close();
return true;
}
@@ -489,7 +491,8 @@ bool StdCWadFile::open(const Common::String &filename) {
int resIndex = resStr.readInt();
// Open up the index for access
- f.open(fname);
+ if (!f.open(fname))
+ return false;
int indexSize = f.readUint32LE() / 4;
assert(resIndex < indexSize);