diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp
index f1767a641a2371ef948c5b63a909822f9903489b..35ea3404fa7c787738459c4099f155bd245935d6 100644
--- a/indra/newview/lldrawpool.cpp
+++ b/indra/newview/lldrawpool.cpp
@@ -471,13 +471,15 @@ void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL ba
 
 	if (texture)
 	{
-		if (batch_textures && params.mTextureList.size() > 1)
+		const U32 tex_list_size = params.mTextureList.size();
+		if (batch_textures && tex_list_size > 1)
 		{
-			for (U32 i = 0; i < params.mTextureList.size(); ++i)
+			for (U32 i = 0; i < tex_list_size; ++i)
 			{
-				if (params.mTextureList[i].notNull())
+				LLViewerTexture* texture = params.mTextureList[i];
+				if (texture)
 				{
-					gGL.getTexUnit(i)->bind(params.mTextureList[i], TRUE);
+					gGL.getTexUnit(i)->bind(texture, TRUE);
 				}
 			}
 		}
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index f42fc69e13cd982cd85ba699484ccbd43e8d8809..989127fb6fa141f35f8c6f6dd95c35d443b3fdde 100644
--- a/indra/newview/lldrawpoolbump.cpp
+++ b/indra/newview/lldrawpoolbump.cpp
@@ -1504,13 +1504,15 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL
 
 	bool tex_setup = false;
 
-	if (batch_textures && params.mTextureList.size() > 1)
+	const U32 tex_list_size = params.mTextureList.size();
+	if (batch_textures && tex_list_size > 1)
 	{
-		for (U32 i = 0; i < params.mTextureList.size(); ++i)
+		for (U32 i = 0; i < tex_list_size; ++i)
 		{
-			if (params.mTextureList[i].notNull())
+			LLViewerTexture* texturep = params.mTextureList[i];
+			if (texturep)
 			{
-				gGL.getTexUnit(i)->bind(params.mTextureList[i], TRUE);
+				gGL.getTexUnit(i)->bind(texturep, TRUE);
 			}
 		}
 	}
diff --git a/indra/newview/lldrawpoolmaterials.cpp b/indra/newview/lldrawpoolmaterials.cpp
index 05b0c1f1a93c6c666bee6916611e082206dccdd9..6d5339f917ccacd1f03762d4690bf0145d4b8fb6 100644
--- a/indra/newview/lldrawpoolmaterials.cpp
+++ b/indra/newview/lldrawpoolmaterials.cpp
@@ -177,13 +177,15 @@ void LLDrawPoolMaterials::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture,
 	
 	bool tex_setup = false;
 	
-	if (batch_textures && params.mTextureList.size() > 1)
+	const U32 tex_list_size = params.mTextureList.size();
+	if (batch_textures && tex_list_size > 1)
 	{
-		for (U32 i = 0; i < params.mTextureList.size(); ++i)
+		for (U32 i = 0; i < tex_list_size; ++i)
 		{
-			if (params.mTextureList[i].notNull())
+			LLViewerTexture* texturep = params.mTextureList[i];
+			if (texturep)
 			{
-				gGL.getTexUnit(i)->bind(params.mTextureList[i], TRUE);
+				gGL.getTexUnit(i)->bind(texturep, TRUE);
 			}
 		}
 	}