From 0464dbb64e5750ee8a00a54fbb0e2f147b83c883 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 31 Aug 2014 01:38:35 +0300 Subject: [PATCH] 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. --- source/resourcemanager.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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); } -- 2.45.2