]> git.tdb.fi Git - libs/datafile.git/commitdiff
Throw an exception if a future object couldn't be created
authorMikko Rasa <tdb@tdb.fi>
Fri, 28 Sep 2012 23:01:34 +0000 (02:01 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 28 Sep 2012 23:01:34 +0000 (02:01 +0300)
source/collection.h

index 9f5ddfcf7f78e5ba988636cc501edf05a87247a2..c83b4376d20b2b6d4854b29dfc0fbda9c0c286b5 100644 (file)
@@ -485,7 +485,10 @@ T &Collection::get(const std::string &name)
                if((*j)->can_create() && (*j)->check_type<NCT>())
                        (*j)->create_item(*this, name);
 
-       return *get_item(items, name).value<RefPtr<NCT> >();
+       NCT *ptr = get_item(items, name).value<RefPtr<NCT> >().get();
+       if(!ptr)
+               throw key_error(typeid(ItemMap));
+       return *ptr;
 }
 
 template<typename T>