From 80db39181685f05cbf33b1ea9d24f3d2e99dbcbc Mon Sep 17 00:00:00 2001
From: "Nyx (Neal Orman)" <nyx@lindenlab.com>
Date: Thu, 7 Jan 2010 11:36:11 -0500
Subject: [PATCH] EXT-3973 viewer crash

Rendering cost calculations didn't handle the case of a face having no image
associated with it. Added in null checks before using the pointer to the image.
Crash no longer repros.

Code reviewed by Vir.
---
 indra/newview/llvovolume.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 70bfc67523..55609621b3 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -2689,13 +2689,16 @@ U32 LLVOVolume::getRenderCost(std::set<LLUUID> &textures) const
 		const LLTextureEntry* te = face->getTextureEntry();
 		const LLViewerTexture* img = face->getTexture();
 
-		textures.insert(img->getID());
+		if (img)
+		{
+			textures.insert(img->getID());
+		}
 
 		if (face->getPoolType() == LLDrawPool::POOL_ALPHA)
 		{
 			alpha++;
 		}
-		else if (img->getPrimaryFormat() == GL_ALPHA)
+		else if (img && img->getPrimaryFormat() == GL_ALPHA)
 		{
 			invisi = 1;
 		}
-- 
GitLab