From: Mikko Rasa Date: Sat, 30 Aug 2014 22:38:35 +0000 (+0300) Subject: Throw an exception if Resource::load did not create an AsyncLoader X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=0464dbb64e5750ee8a00a54fbb0e2f147b83c883;p=libs%2Fgl.git Throw an exception if Resource::load did not create an AsyncLoader This is only a safeguard against programming errors and should never be hit in normal use. --- diff --git a/source/resourcemanager.cpp b/source/resourcemanager.cpp index 98a49744..b778175e 100644 --- a/source/resourcemanager.cpp +++ b/source/resourcemanager.cpp @@ -46,6 +46,12 @@ void ResourceManager::load_resource(const Resource &r) managed.io = managed.collection->open_raw(managed.name); managed.loader = managed.resource->load(*managed.io); + if(!managed.loader) + { + delete managed.io; + managed.io = 0; + throw logic_error("no loader created"); + } queue.push_back(&managed); }