From 7880b1767636a4cea1e5f1a918e083f784b44674 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 9 Nov 2016 22:03:40 -0500 Subject: TITANIC: Gracefully handle cases of specified sounds missing --- engines/titanic/support/simple_file.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'engines/titanic/support') 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); -- cgit v1.2.3