diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 92e00e0cae6ae5d9b62d75f9d4bd87dac98847a3..a949830dcf7772b3583988799a00974744e36879 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -156,6 +156,11 @@ LLViewerMediaTexture*  LLViewerTextureManager::getMediaTexture(const LLUUID& id,
 
 LLViewerFetchedTexture* LLViewerTextureManager::staticCastToFetchedTexture(LLViewerTexture* tex, BOOL report_error)
 {
+	if(!tex)
+	{
+		return NULL ;
+	}
+
 	S8 type = tex->getType() ;
 	if(type == LLViewerTexture::FETCHED_TEXTURE || type == LLViewerTexture::LOD_TEXTURE)
 	{