From 348a6d9ca1a9b3838ff8c6da5050f61b2c74d010 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 29 Sep 2012 02:01:34 +0300 Subject: [PATCH] Throw an exception if a future object couldn't be created --- source/collection.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- 2.45.2