aboutsummaryrefslogtreecommitdiff
path: root/common/fs.cpp
diff options
context:
space:
mode:
authorMax Horn2008-09-07 21:47:01 +0000
committerMax Horn2008-09-07 21:47:01 +0000
commitabffd3b3ab0d4c0af833696da3bcc819b2bf6aa8 (patch)
tree5b9d38ccb15249088652187b0a1fa6591294ce49 /common/fs.cpp
parent7aaf6139e25b55d4eca335553fe6da654ba1b341 (diff)
downloadscummvm-rg350-abffd3b3ab0d4c0af833696da3bcc819b2bf6aa8.tar.gz
scummvm-rg350-abffd3b3ab0d4c0af833696da3bcc819b2bf6aa8.tar.bz2
scummvm-rg350-abffd3b3ab0d4c0af833696da3bcc819b2bf6aa8.zip
Allow invoking FilesystemNode::getChild on non-dir nodes, by returning an invalid node in that case
svn-id: r34429
Diffstat (limited to 'common/fs.cpp')
-rw-r--r--common/fs.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/common/fs.cpp b/common/fs.cpp
index d8f065b449..f7edf41711 100644
--- a/common/fs.cpp
+++ b/common/fs.cpp
@@ -62,10 +62,10 @@ bool FilesystemNode::exists() const {
}
FilesystemNode FilesystemNode::getChild(const Common::String &n) const {
- if (_realNode == 0)
- return *this;
+ // If this node is invalid or not a directory, return an invalid node
+ if (_realNode == 0 || !_realNode->isDirectory())
+ return FilesystemNode();
- assert(_realNode->isDirectory());
AbstractFilesystemNode *node = _realNode->getChild(n);
return FilesystemNode(node);
}