From 24a5a7e6dced2dbb44be06ca821e9600306b0bfd Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 29 Sep 2014 23:35:16 +0300 Subject: [PATCH] Avoid segfaults when LoadingThread's resource is cleared --- source/resourcemanager.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/resourcemanager.cpp b/source/resourcemanager.cpp index c9cbcbb7..999b86c1 100644 --- a/source/resourcemanager.cpp +++ b/source/resourcemanager.cpp @@ -295,9 +295,12 @@ void ResourceManager::LoadingThread::set_resource(ManagedResource *r) } resource = r; - resource->start_loading(); - state = BUSY; - sem.signal(); + if(resource) + { + resource->start_loading(); + state = BUSY; + sem.signal(); + } } void ResourceManager::LoadingThread::sync() -- 2.45.2