Protect against missing texture cache on shutdown

This commit is contained in:
Brad Davis 2017-03-14 13:48:24 -07:00
parent a41146451b
commit 5e716f15b5

View file

@ -189,9 +189,13 @@ NetworkTexturePointer TextureCache::getTexture(const QUrl& url, Type type, const
}
gpu::TexturePointer getFallbackTextureForType(NetworkTexture::Type type) {
auto textureCache = DependencyManager::get<TextureCache>();
gpu::TexturePointer result;
auto textureCache = DependencyManager::get<TextureCache>();
// Since this can be called on a background thread, there's a chance that the cache
// will be destroyed by the time we request it
if (!textureCache) {
return result;
}
switch (type) {
case NetworkTexture::DEFAULT_TEXTURE:
case NetworkTexture::ALBEDO_TEXTURE: