From: Mikko Rasa Date: Fri, 28 Sep 2012 23:01:34 +0000 (+0300) Subject: Throw an exception if a future object couldn't be created X-Git-Url: http://git.tdb.fi/?p=libs%2Fdatafile.git;a=commitdiff_plain;h=348a6d9ca1a9b3838ff8c6da5050f61b2c74d010 Throw an exception if a future object couldn't be created --- diff --git a/source/collection.h b/source/collection.h index 9f5ddfc..c83b437 100644 --- a/source/collection.h +++ b/source/collection.h @@ -485,7 +485,10 @@ T &Collection::get(const std::string &name) if((*j)->can_create() && (*j)->check_type()) (*j)->create_item(*this, name); - return *get_item(items, name).value >(); + NCT *ptr = get_item(items, name).value >().get(); + if(!ptr) + throw key_error(typeid(ItemMap)); + return *ptr; } template