diff --git a/Engine/AppManager.cpp b/Engine/AppManager.cpp index 586c5e303..8712eec00 100644 --- a/Engine/AppManager.cpp +++ b/Engine/AppManager.cpp @@ -457,9 +457,15 @@ AppManager::~AppManager() QThreadPool::globalInstance()->waitForDone(); ///Kill caches now because decreaseNCacheFilesOpened can be called - _imp->_nodeCache->waitForDeleterThread(); - _imp->_diskCache->waitForDeleterThread(); - _imp->_viewerCache->waitForDeleterThread(); + if (_imp->_nodeCache) { + _imp->_nodeCache->waitForDeleterThread(); + } + if (_imp->_diskCache) { + _imp->_diskCache->waitForDeleterThread(); + } + if (_imp->_viewerCache) { + _imp->_viewerCache->waitForDeleterThread(); + } _imp->_nodeCache.reset(); _imp->_viewerCache.reset(); _imp->_diskCache.reset(); diff --git a/Engine/AppManagerPrivate.cpp b/Engine/AppManagerPrivate.cpp index 55922950c..6f396a3cb 100644 --- a/Engine/AppManagerPrivate.cpp +++ b/Engine/AppManagerPrivate.cpp @@ -448,6 +448,10 @@ template void saveCache(Cache* cache) { + if (!cache) { + return; + } + std::string cacheRestoreFilePath = cache->getRestoreFilePath(); FStreamsSupport::ofstream ofile; FStreamsSupport::open(&ofile, cacheRestoreFilePath);