aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/wintermute/base/file/base_disk_file.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/engines/wintermute/base/file/base_disk_file.cpp b/engines/wintermute/base/file/base_disk_file.cpp
index 09a83f5768..c03a9b61e7 100644
--- a/engines/wintermute/base/file/base_disk_file.cpp
+++ b/engines/wintermute/base/file/base_disk_file.cpp
@@ -69,14 +69,19 @@ static Common::FSNode getNodeForRelativePath(const Common::String& filename) {
Common::String pathPart = path.nextToken();
// Get the next FSNode in the chain, if it exists as a child from the previous.
Common::FSNode nextNode(curNode.getChild(pathPart));
+ if (!nextNode.exists()) {
+ // Return an invalid FSNode.
+ return Common::FSNode();
+ }
if (nextNode.exists() && nextNode.isReadable()) {
curNode = nextNode;
}
// Following the comments in common/fs.h, anything not a directory is a file.
if (!curNode.isDirectory()) {
- assert(path.empty());
+ if (!path.empty()) {
+ error("Relative path %s reached a file before the end of the path", filename.c_str());
+ }
return curNode;
- break;
}
}
}