]> git.tdb.fi Git - libs/datafile.git/commitdiff
Return null instead of throwing if a file is not found in sources
authorMikko Rasa <tdb@tdb.fi>
Tue, 26 Mar 2013 20:15:19 +0000 (22:15 +0200)
committerMikko Rasa <tdb@tdb.fi>
Tue, 26 Mar 2013 20:15:19 +0000 (22:15 +0200)
The primary use case for open_from_sources is for creator functions to
open raw files.  This change makes it easier to gracefully skip a non-
existent file and carry on with other ways of loading the item.

source/collection.cpp

index 984fb74da8e7a6007645e6f85aa002b8ae6f894a..aa607bdedcde65ecfd298b21af06fc9dc42aeac2 100644 (file)
@@ -97,7 +97,7 @@ IO::Seekable *Collection::open_from_sources(const string &name)
                if(IO::Seekable *io = (*i)->open(name))
                        return io;
 
-       throw IO::file_not_found(name);
+       return 0;
 }
 
 void Collection::gather_names_from_sources(list<string> &names, const CollectionItemTypeBase &type) const