From: Mikko Rasa Date: Sat, 5 Sep 2015 20:04:06 +0000 (+0300) Subject: Add a safeguard to resource_used X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=918394ff1726a11523fd090b1f92c8657292e0cf;p=libs%2Fgl.git Add a safeguard to resource_used It's externally accessible and someone might call it with a resource which is not registered with that manager. --- diff --git a/source/resourcemanager.cpp b/source/resourcemanager.cpp index f008fd27..e989a5d0 100644 --- a/source/resourcemanager.cpp +++ b/source/resourcemanager.cpp @@ -120,6 +120,8 @@ bool ResourceManager::is_resource_loaded(const Resource &r) const void ResourceManager::resource_used(const Resource &r) { ManagedResource *managed = reinterpret_cast(r.get_manager_data()); + if(!managed) + return; if(managed->state==ManagedResource::NOT_LOADED && policy!=LOAD_MANUALLY) load_resource(*managed->resource);