]> git.tdb.fi Git - libs/gl.git/commitdiff
Throw an exception if Resource::load did not create an AsyncLoader
authorMikko Rasa <tdb@tdb.fi>
Sat, 30 Aug 2014 22:38:35 +0000 (01:38 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 30 Aug 2014 22:38:35 +0000 (01:38 +0300)
This is only a safeguard against programming errors and should never be
hit in normal use.

source/resourcemanager.cpp

index 98a49744a702c2ecaf7db14a99c0afbf4da6158a..b778175e12d7d59e8898b1f7c53b4eace1cc5cef 100644 (file)
@@ -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);
 }