From 918394ff1726a11523fd090b1f92c8657292e0cf Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 5 Sep 2015 23:04:06 +0300 Subject: [PATCH] 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. --- source/resourcemanager.cpp | 2 ++ 1 file changed, 2 insertions(+) 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); -- 2.45.2