aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/fs.cpp6
-rw-r--r--common/fs.h2
2 files changed, 4 insertions, 4 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);
}
diff --git a/common/fs.h b/common/fs.h
index 9163dbadce..b19abd0a80 100644
--- a/common/fs.h
+++ b/common/fs.h
@@ -103,7 +103,7 @@ public:
/**
* Create a new node referring to a child node of the current node, which
- * must be a directory node (an assertion is triggered otherwise).
+ * must be a directory node (otherwise an invalid node is returned).
* If a child matching the name exists, a normal node for it is returned.
* If no child with the name exists, a node for it is still returned,
* but exists() will return 'false' for it. This node can however be used