[Scummvm-cvs-logs] SF.net SVN: scummvm:[34429] scummvm/trunk/common

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sun Sep 7 23:47:02 CEST 2008


Revision: 34429
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34429&view=rev
Author:   fingolfin
Date:     2008-09-07 21:47:01 +0000 (Sun, 07 Sep 2008)

Log Message:
-----------
Allow invoking FilesystemNode::getChild on non-dir nodes, by returning an invalid node in that case

Modified Paths:
--------------
    scummvm/trunk/common/fs.cpp
    scummvm/trunk/common/fs.h

Modified: scummvm/trunk/common/fs.cpp
===================================================================
--- scummvm/trunk/common/fs.cpp	2008-09-07 21:46:37 UTC (rev 34428)
+++ scummvm/trunk/common/fs.cpp	2008-09-07 21:47:01 UTC (rev 34429)
@@ -62,10 +62,10 @@
 }
 
 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 ||\xA0!_realNode->isDirectory())
+		return FilesystemNode();
 
-	assert(_realNode->isDirectory());
 	AbstractFilesystemNode *node = _realNode->getChild(n);
 	return FilesystemNode(node);
 }

Modified: scummvm/trunk/common/fs.h
===================================================================
--- scummvm/trunk/common/fs.h	2008-09-07 21:46:37 UTC (rev 34428)
+++ scummvm/trunk/common/fs.h	2008-09-07 21:47:01 UTC (rev 34429)
@@ -103,7 +103,7 @@
 
 	/**
 	 * 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


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list