mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-19 08:25:35 +00:00
Allow invoking FilesystemNode::getChild on non-dir nodes, by returning an invalid node in that case
svn-id: r34429
This commit is contained in:
parent
7aaf6139e2
commit
abffd3b3ab
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user