From: Mikko Rasa Date: Tue, 26 Mar 2013 20:15:19 +0000 (+0200) Subject: Return null instead of throwing if a file is not found in sources X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=00795982c9a99dcad69b33f75d38328165bd5df8;p=libs%2Fdatafile.git Return null instead of throwing if a file is not found in sources 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. --- diff --git a/source/collection.cpp b/source/collection.cpp index 984fb74..aa607bd 100644 --- a/source/collection.cpp +++ b/source/collection.cpp @@ -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 &names, const CollectionItemTypeBase &type) const