From 816e8578f9b63640afde942df282ccf5ed1385a5 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Wed, 16 Apr 2014 13:21:06 -0500
Subject: [PATCH] Backed out changeset: d0dfe3cda5b1

---
 indra/llappearance/lltexlayer.cpp       |  5 +--
 indra/llappearance/llwearable.cpp       | 11 +------
 indra/llimage/llimage.cpp               | 28 +++--------------
 indra/llimage/llimageworker.cpp         | 16 +++-------
 indra/llrender/llcubemap.cpp            |  5 ---
 indra/llrender/llfontfreetype.cpp       | 15 ++-------
 indra/llrender/llimagegl.cpp            |  5 ---
 indra/newview/lldrawpoolbump.cpp        |  1 -
 indra/newview/lldrawpoolterrain.cpp     | 18 +++--------
 indra/newview/llnetmap.cpp              |  5 +--
 indra/newview/llstartup.cpp             |  2 +-
 indra/newview/llsurface.cpp             | 12 --------
 indra/newview/lltexturecache.cpp        |  2 +-
 indra/newview/llviewerparceloverlay.cpp | 20 +++++-------
 indra/newview/llviewertexture.cpp       | 15 ++-------
 indra/newview/llvoavatarself.cpp        |  9 ++----
 indra/newview/llvosky.cpp               | 41 ++++++++++---------------
 indra/newview/llworld.cpp               | 22 +++++--------
 indra/newview/pipeline.cpp              |  8 ++---
 19 files changed, 60 insertions(+), 180 deletions(-)

diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp
index 4cf82a3740d..63d01999f06 100644
--- a/indra/llappearance/lltexlayer.cpp
+++ b/indra/llappearance/lltexlayer.cpp
@@ -1973,10 +1973,7 @@ LLGLTexture* LLTexLayerStaticImageList::getTexture(const std::string& file_name,
 	}
 	else
 	{
-		if (!gTextureManagerBridgep)
-		{
-			return LLPointer<LLGLTexture>();
-		}
+		llassert(gTextureManagerBridgep);
 		tex = gTextureManagerBridgep->getLocalTexture( FALSE );
 		LLPointer<LLImageRaw> image_raw = new LLImageRaw;
 		if( loadImageRaw( file_name, image_raw ) )
diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp
index 61cd995cea1..d86a460511f 100644
--- a/indra/llappearance/llwearable.cpp
+++ b/indra/llappearance/llwearable.cpp
@@ -420,12 +420,6 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream,
 				return LLWearable::FAILURE;
 		}
 		LLUUID id = LLUUID(uuid_buffer);
-
-		if (!gTextureManagerBridgep)
-		{
-			continue;
-		}
-
 		LLGLTexture* image = gTextureManagerBridgep->getFetchedTexture( id );
 		if( mTEMap.find(te) != mTEMap.end() )
 		{
@@ -598,10 +592,7 @@ void LLWearable::syncImages(te_map_t &src, te_map_t &dst)
 			{
 				// there is no Local Texture Object in the source image map. Get defaults values for populating the destination image map.
 				image_id = getDefaultTextureImageID((ETextureIndex) te);
-				if (gTextureManagerBridgep)
-				{
-					image = gTextureManagerBridgep->getFetchedTexture( image_id );
-				}
+				image = gTextureManagerBridgep->getFetchedTexture( image_id );
 			}
 
 			if( dst.find(te) != dst.end() )
diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp
index 183620f9bc0..c8a05e1faea 100755
--- a/indra/llimage/llimage.cpp
+++ b/indra/llimage/llimage.cpp
@@ -230,7 +230,7 @@ const U8* LLImageBase::getData() const
 { 
 	if(mBadBufferAllocation)
 	{
-		llwarns << "Bad memory allocation for the image buffer!" << llendl ;
+		llerrs << "Bad memory allocation for the image buffer!" << llendl ;
 	}
 
 	return mData; 
@@ -240,7 +240,7 @@ U8* LLImageBase::getData()
 { 
 	if(mBadBufferAllocation)
 	{
-		llwarns << "Bad memory allocation for the image buffer!" << llendl ;
+		llerrs << "Bad memory allocation for the image buffer!" << llendl ;
 	}
 
 	return mData; 
@@ -293,7 +293,7 @@ LLImageRaw::LLImageRaw(U8 *data, U16 width, U16 height, S8 components, bool no_c
 	{
 		setDataAndSize(data, width, height, components);
 	}
-	else if(allocateDataSize(width, height, components) && getData())
+	else if(allocateDataSize(width, height, components))
 	{
 		memcpy(getData(), data, width*height*components);
 	}
@@ -431,11 +431,6 @@ void LLImageRaw::clear(U8 r, U8 g, U8 b, U8 a)
 // Reverses the order of the rows in the image
 void LLImageRaw::verticalFlip()
 {
-	if (!getData())
-	{
-		return;
-	}
-
 	S32 row_bytes = getWidth() * getComponents();
 	llassert(row_bytes > 0);
 	std::vector<U8> line_buffer(row_bytes);
@@ -671,11 +666,6 @@ void LLImageRaw::copyUnscaledAlphaMask( LLImageRaw* src, const LLColor4U& fill)
 // Fill the buffer with a constant color
 void LLImageRaw::fill( const LLColor4U& color )
 {
-	if (!getData())
-	{
-		return;
-	}
-
 	S32 pixels = getWidth() * getHeight();
 	if( 4 == getComponents() )
 	{
@@ -877,11 +867,6 @@ void LLImageRaw::copyScaled( LLImageRaw* src )
 
 BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data )
 {
-	if (!getData())
-	{
-		return FALSE;
-	}
-
 	llassert((1 == getComponents()) || (3 == getComponents()) || (4 == getComponents()) );
 
 	S32 old_width = getWidth();
@@ -916,7 +901,7 @@ BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data )
 			copyLineScaled( &temp_buffer[0] + (getComponents() * old_width * row), new_buffer + (getComponents() * new_width * row), old_width, new_width, 1, 1 );
 		}
 	}
-	else if (getData())
+	else
 	{
 		// copy	out	existing image data
 		S32	temp_data_size = old_width * old_height	* getComponents();
@@ -1579,11 +1564,6 @@ BOOL LLImageFormatted::load(const std::string &filename, int load_size)
 
 BOOL LLImageFormatted::save(const std::string &filename)
 {
-	if (!getData())
-	{
-		return FALSE;
-	}
-
 	resetLastError();
 
 	LLAPRFile outfile ;
diff --git a/indra/llimage/llimageworker.cpp b/indra/llimage/llimageworker.cpp
index e425823c593..ad2eb0f69c5 100755
--- a/indra/llimage/llimageworker.cpp
+++ b/indra/llimage/llimageworker.cpp
@@ -142,12 +142,8 @@ bool LLImageDecodeThread::ImageRequest::processRequest()
 											  mFormattedImage->getHeight(),
 											  mFormattedImage->getComponents());
 		}
-
-		//if (mDecodedImageRaw->getData()))
-		{
-			done = mFormattedImage->decode(mDecodedImageRaw, decode_time_slice); // 1ms
-			mDecodedRaw = done;
-		}
+		done = mFormattedImage->decode(mDecodedImageRaw, decode_time_slice); // 1ms
+		mDecodedRaw = done;
 	}
 	if (done && mNeedsAux && !mDecodedAux && mFormattedImage.notNull())
 	{
@@ -158,12 +154,8 @@ bool LLImageDecodeThread::ImageRequest::processRequest()
 											  mFormattedImage->getHeight(),
 											  1);
 		}
-
-		//if (mDecodedImageAux->getData())
-		{
-			done = mFormattedImage->decodeChannels(mDecodedImageAux, decode_time_slice, 4, 4); // 1ms
-			mDecodedAux = done;
-		}
+		done = mFormattedImage->decodeChannels(mDecodedImageAux, decode_time_slice, 4, 4); // 1ms
+		mDecodedAux = done;
 	}
 
 	return done;
diff --git a/indra/llrender/llcubemap.cpp b/indra/llrender/llcubemap.cpp
index 0dad4285d93..45a3b18179a 100755
--- a/indra/llrender/llcubemap.cpp
+++ b/indra/llrender/llcubemap.cpp
@@ -116,11 +116,6 @@ void LLCubeMap::initRawData(const std::vector<LLPointer<LLImageRaw> >& rawimages
 		const U8 *sd = rawimages[i]->getData();
 		U8 *td = mRawImages[i]->getData();
 
-		if (!sd || !td)
-		{
-			continue;
-		}
-
 		S32 offset = 0;
 		S32 sx, sy, so;
 		for (int y = 0; y < 64; y++)
diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp
index 7ab4e93da5d..84c782e9581 100755
--- a/indra/llrender/llfontfreetype.cpp
+++ b/indra/llrender/llfontfreetype.cpp
@@ -448,11 +448,7 @@ LLFontGlyphInfo* LLFontFreetype::addGlyphFromFont(const LLFontFreetype *fontp, l
 	
 	LLImageGL *image_gl = mFontBitmapCachep->getImageGL(bitmap_num);
 	LLImageRaw *image_raw = mFontBitmapCachep->getImageRaw(bitmap_num);
-	
-	if (image_gl)
-	{
-		image_gl->setSubImage(image_raw, 0, 0, image_gl->getWidth(), image_gl->getHeight());
-	}
+	image_gl->setSubImage(image_raw, 0, 0, image_gl->getWidth(), image_gl->getHeight());
 
 	return gi;
 }
@@ -564,18 +560,13 @@ void LLFontFreetype::setSubImageLuminanceAlpha(U32 x, U32 y, U32 bitmap_num, U32
 {
 	LLImageRaw *image_raw = mFontBitmapCachep->getImageRaw(bitmap_num);
 
-	if (!image_raw)
-	{
-		return;
-	}
-
 	llassert(!mIsFallback);
-	llassert(image_raw->getComponents() == 2);
+	llassert(image_raw && (image_raw->getComponents() == 2));
 
 	
 	U8 *target = image_raw->getData();
 
-	if (!data || !target)
+	if (!data)
 	{
 		return;
 	}
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 315cc57e517..ab875141c57 100755
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -1251,11 +1251,6 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S
 		return FALSE;
 	}
 
-	if (!imageraw->getData())
-	{
-		return FALSE;
-	}
-
 	mGLTextureCreated = false ;
 	llassert(gGLManager.mInited);
 	stop_glerror();
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index 49ac82e786d..6b4c5cfca1a 100755
--- a/indra/newview/lldrawpoolbump.cpp
+++ b/indra/newview/lldrawpoolbump.cpp
@@ -1232,7 +1232,6 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI
 
 		//if (iter->second->getWidth() != src->getWidth() ||
 		//	iter->second->getHeight() != src->getHeight()) // bump not cached yet or has changed resolution
-		if (src->getData())
 		{
 			LLPointer<LLImageRaw> dst_image = new LLImageRaw(src->getWidth(), src->getHeight(), 1);
 			U8* dst_data = dst_image->getData();
diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp
index d7ecacf2e67..c3ec2342231 100755
--- a/indra/newview/lldrawpoolterrain.cpp
+++ b/indra/newview/lldrawpoolterrain.cpp
@@ -88,11 +88,8 @@ LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerTexture *texturep) :
 	//gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get());
 	m2DAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP);
 	
-	if (mTexturep)
-	{
-		mTexturep->setBoostLevel(LLGLTexture::BOOST_TERRAIN);
-	}
-
+	mTexturep->setBoostLevel(LLGLTexture::BOOST_TERRAIN);
+	
 	//gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 }
 
@@ -854,18 +851,11 @@ void LLDrawPoolTerrain::renderSimple()
 	// Pass 1/1
 
 	// Stage 0: Base terrain texture pass
-	if (mTexturep)
-	{
-		mTexturep->addTextureStats(1024.f*1024.f);
-	}
+	mTexturep->addTextureStats(1024.f*1024.f);
 
 	gGL.getTexUnit(0)->activate();
 	gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
-
-	if (mTexturep)
-	{
-		gGL.getTexUnit(0)->bind(mTexturep);
-	}
+	gGL.getTexUnit(0)->bind(mTexturep);
 	
 	LLVector3 origin_agent = mDrawFace[0]->getDrawable()->getVObj()->getRegion()->getOriginAgent();
 	F32 tscale = 1.f/256.f;
diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp
index 193e2ea678a..08b5eaedbbe 100755
--- a/indra/newview/llnetmap.cpp
+++ b/indra/newview/llnetmap.cpp
@@ -798,10 +798,7 @@ void LLNetMap::createObjectImage()
 	{
 		mObjectRawImagep = new LLImageRaw(img_size, img_size, 4);
 		U8* data = mObjectRawImagep->getData();
-		if (data)
-		{
-			memset( data, 0, img_size * img_size * 4 );
-		}
+		memset( data, 0, img_size * img_size * 4 );
 		mObjectImagep = LLViewerTextureManager::getLocalTexture( mObjectRawImagep.get(), FALSE);
 	}
 	setScale(mScale);
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 924ba0559ca..3b52025a23e 100755
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -2684,7 +2684,7 @@ void init_start_screen(S32 location_id)
 		}
 	}
 
-	if(gStartTexture && gStartTexture.isNull())
+	if(gStartTexture.isNull())
 	{
 		gStartTexture = LLViewerTexture::sBlackImagep ;
 		gStartImageWidth = gStartTexture->getWidth() ;
diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp
index f1b27279e3a..93c7f541013 100755
--- a/indra/newview/llsurface.cpp
+++ b/indra/newview/llsurface.cpp
@@ -233,12 +233,6 @@ void LLSurface::createSTexture()
 		// GL NOT ACTIVE HERE
 		LLPointer<LLImageRaw> raw = new LLImageRaw(sTextureSize, sTextureSize, 3);
 		U8 *default_texture = raw->getData();
-
-		if (!default_texture)
-		{
-			return;
-		}
-
 		for (S32 i = 0; i < sTextureSize; i++)
 		{
 			for (S32 j = 0; j < sTextureSize; j++)
@@ -263,12 +257,6 @@ void LLSurface::createWaterTexture()
 		// Create the water texture
 		LLPointer<LLImageRaw> raw = new LLImageRaw(sTextureSize/2, sTextureSize/2, 4);
 		U8 *default_texture = raw->getData();
-
-		if (!default_texture)
-		{
-			return;
-		}
-
 		for (S32 i = 0; i < sTextureSize/2; i++)
 		{
 			for (S32 j = 0; j < sTextureSize/2; j++)
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index 8d9d2421da7..5bc2e971ebe 100755
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -1937,7 +1937,7 @@ bool LLTextureCache::writeToFastCache(S32 id, LLPointer<LLImageRaw> raw, S32 dis
 	memcpy(mFastCachePadBuffer + sizeof(S32) * 3, &discardlevel, sizeof(S32));
 
 	S32 copy_size = w * h * c;
-	if(copy_size > 0 && raw->getData()) //valid
+	if(copy_size > 0) //valid
 	{
 		copy_size = llmin(copy_size, TEXTURE_FAST_CACHE_ENTRY_SIZE - TEXTURE_FAST_CACHE_ENTRY_OVERHEAD);
 		memcpy(mFastCachePadBuffer + TEXTURE_FAST_CACHE_ENTRY_OVERHEAD, raw->getData(), copy_size);
diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp
index fad77bce255..a1c12c5cd6e 100755
--- a/indra/newview/llviewerparceloverlay.cpp
+++ b/indra/newview/llviewerparceloverlay.cpp
@@ -76,13 +76,10 @@ LLViewerParcelOverlay::LLViewerParcelOverlay(LLViewerRegion* region, F32 region_
 	//
 	// Create the base texture.
 	U8 *raw = mImageRaw->getData();
-	if (raw)
+	const S32 COUNT = mParcelGridsPerEdge * mParcelGridsPerEdge * OVERLAY_IMG_COMPONENTS;
+	for (S32 i = 0; i < COUNT; i++)
 	{
-		const S32 COUNT = mParcelGridsPerEdge * mParcelGridsPerEdge * OVERLAY_IMG_COMPONENTS;
-		for (S32 i = 0; i < COUNT; i++)
-		{
-			raw[i] = 0;
-		}
+		raw[i] = 0;
 	}
 	//mTexture->setSubImage(mImageRaw, 0, 0, mParcelGridsPerEdge, mParcelGridsPerEdge);
 
@@ -383,13 +380,10 @@ void LLViewerParcelOverlay::updateOverlayTexture()
 			break;
 		}
 
-		if (raw)
-		{
-			raw[pixel_index + 0] = (U8)r;
-			raw[pixel_index + 1] = (U8)g;
-			raw[pixel_index + 2] = (U8)b;
-			raw[pixel_index + 3] = (U8)a;
-		}
+		raw[pixel_index + 0] = (U8)r;
+		raw[pixel_index + 1] = (U8)g;
+		raw[pixel_index + 2] = (U8)b;
+		raw[pixel_index + 3] = (U8)a;
 
 		pixel_index += OVERLAY_IMG_COMPONENTS;
 	}
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 6364eee3ec8..3da6d33d728 100755
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -337,11 +337,6 @@ void LLViewerTextureManager::init()
 	const S32 dim = 128;
 	LLPointer<LLImageRaw> image_raw = new LLImageRaw(dim,dim,3);
 	U8* data = image_raw->getData();
-
-	if (!data)
-	{
-		return;
-	}
 	
 	memset(data, 0, dim * dim * 3) ;
 	LLViewerTexture::sBlackImagep = LLViewerTextureManager::getLocalTexture(image_raw.get(), TRUE) ;
@@ -378,12 +373,8 @@ void LLViewerTextureManager::init()
 #else
  	LLViewerFetchedTexture::sDefaultImagep = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
 #endif
-
-	if (LLViewerFetchedTexture::sDefaultImagep)
-	{
-		LLViewerFetchedTexture::sDefaultImagep->dontDiscard();
-		LLViewerFetchedTexture::sDefaultImagep->setCategory(LLGLTexture::OTHER) ;
-	}
+	LLViewerFetchedTexture::sDefaultImagep->dontDiscard();
+	LLViewerFetchedTexture::sDefaultImagep->setCategory(LLGLTexture::OTHER) ;
 
  	LLViewerFetchedTexture::sSmokeImagep = LLViewerTextureManager::getFetchedTexture(IMG_SMOKE, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
 	LLViewerFetchedTexture::sSmokeImagep->setNoDelete() ;
@@ -699,7 +690,7 @@ bool LLViewerTexture::bindDefaultImage(S32 stage)
 	if (stage < 0) return false;
 
 	bool res = true;
-	if (LLViewerFetchedTexture::sDefaultImagep && LLViewerFetchedTexture::sDefaultImagep.notNull() && (this != LLViewerFetchedTexture::sDefaultImagep.get()))
+	if (LLViewerFetchedTexture::sDefaultImagep.notNull() && (this != LLViewerFetchedTexture::sDefaultImagep.get()))
 	{
 		// use default if we've got it
 		res = gGL.getTexUnit(stage)->bind(LLViewerFetchedTexture::sDefaultImagep);
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index ca004962d57..082a85e2171 100755
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -818,8 +818,7 @@ void LLVOAvatarSelf::setLocalTextureTE(U8 te, LLViewerTexture* image, U32 index)
 		return;
 	}
 
-	LLViewerTexture * tx = getTEImage(te);
-	if (!tx || tx->getID() == image->getID())
+	if (getTEImage(te)->getID() == image->getID())
 	{
 		return;
 	}
@@ -1699,7 +1698,6 @@ S32 LLVOAvatarSelf::getLocalDiscardLevel(ETextureIndex type, U32 wearable_index)
 		const LLViewerFetchedTexture* image = dynamic_cast<LLViewerFetchedTexture*>( local_tex_obj->getImage() );
 		if (type >= 0
 			&& local_tex_obj->getID() != IMG_DEFAULT_AVATAR
-			&& image
 			&& !image->isMissingAsset())
 		{
 			return image->getDiscardLevel();
@@ -2038,10 +2036,7 @@ BOOL LLVOAvatarSelf::getIsCloud() const
 /*static*/
 void LLVOAvatarSelf::debugOnTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata)
 {
-	if (gAgentAvatarp)
-	{
-		gAgentAvatarp->debugTimingLocalTexLoaded(success, src_vi, src, aux_src, discard_level, final, userdata);
-	}
+	gAgentAvatarp->debugTimingLocalTexLoaded(success, src_vi, src, aux_src, discard_level, final, userdata);
 }
 
 void LLVOAvatarSelf::debugTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata)
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index 467152881e3..93f0e50336e 100755
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -257,21 +257,18 @@ LLSkyTex::~LLSkyTex()
 void LLSkyTex::initEmpty(const S32 tex)
 {
 	U8* data = mImageRaw[tex]->getData();
-	if (data)
+	for (S32 i = 0; i < sResolution; ++i)
 	{
-		for (S32 i = 0; i < sResolution; ++i)
+		for (S32 j = 0; j < sResolution; ++j)
 		{
-			for (S32 j = 0; j < sResolution; ++j)
-			{
-				const S32 basic_offset = (i * sResolution + j);
-				S32 offset = basic_offset * sComponents;
-				data[offset] = 0;
-				data[offset+1] = 0;
-				data[offset+2] = 0;
-				data[offset+3] = 255;
-
-				mSkyData[basic_offset].setToBlack();
-			}
+			const S32 basic_offset = (i * sResolution + j);
+			S32 offset = basic_offset * sComponents;
+			data[offset] = 0;
+			data[offset+1] = 0;
+			data[offset+2] = 0;
+			data[offset+3] = 255;
+
+			mSkyData[basic_offset].setToBlack();
 		}
 	}
 
@@ -282,21 +279,17 @@ void LLSkyTex::create(const F32 brightness)
 {
 	/// Brightness ignored for now.
 	U8* data = mImageRaw[sCurrent]->getData();
-	if (data)
+	for (S32 i = 0; i < sResolution; ++i)
 	{
-		for (S32 i = 0; i < sResolution; ++i)
+		for (S32 j = 0; j < sResolution; ++j)
 		{
-			for (S32 j = 0; j < sResolution; ++j)
-			{
-				const S32 basic_offset = (i * sResolution + j);
-				S32 offset = basic_offset * sComponents;
-				U32* pix = (U32*)(data + offset);
-				LLColor4U temp = LLColor4U(mSkyData[basic_offset]);
-				*pix = temp.mAll;
-			}
+			const S32 basic_offset = (i * sResolution + j);
+			S32 offset = basic_offset * sComponents;
+			U32* pix = (U32*)(data + offset);
+			LLColor4U temp = LLColor4U(mSkyData[basic_offset]);
+			*pix = temp.mAll;
 		}
 	}
-
 	createGLImage(sCurrent);
 }
 
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index 27256af97aa..85614f397c0 100755
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -101,21 +101,15 @@ LLWorld::LLWorld() :
 
 	LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,4);
 	U8 *default_texture = raw->getData();
+	*(default_texture++) = MAX_WATER_COLOR.mV[0];
+	*(default_texture++) = MAX_WATER_COLOR.mV[1];
+	*(default_texture++) = MAX_WATER_COLOR.mV[2];
+	*(default_texture++) = MAX_WATER_COLOR.mV[3];
+	
+	mDefaultWaterTexturep = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE);
+	gGL.getTexUnit(0)->bind(mDefaultWaterTexturep);
+	mDefaultWaterTexturep->setAddressMode(LLTexUnit::TAM_CLAMP);
 
-	if (default_texture)
-	{
-		*(default_texture++) = MAX_WATER_COLOR.mV[0];
-		*(default_texture++) = MAX_WATER_COLOR.mV[1];
-		*(default_texture++) = MAX_WATER_COLOR.mV[2];
-		*(default_texture++) = MAX_WATER_COLOR.mV[3];
-	}
-
-	if (mDefaultWaterTexturep)
-	{
-		mDefaultWaterTexturep = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE);
-		gGL.getTexUnit(0)->bind(mDefaultWaterTexturep);
-		mDefaultWaterTexturep->setAddressMode(LLTexUnit::TAM_CLAMP);
-	}
 }
 
 
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 0af1143ae83..5da8a78b1b4 100755
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -4410,11 +4410,9 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
 		sUnderWaterRender = FALSE;
 	}
 
-	if (LLViewerFetchedTexture::sDefaultImagep)
-	{
-		gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sDefaultImagep);
-		LLViewerFetchedTexture::sDefaultImagep->setAddressMode(LLTexUnit::TAM_WRAP);
-	}
+	gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sDefaultImagep);
+	LLViewerFetchedTexture::sDefaultImagep->setAddressMode(LLTexUnit::TAM_WRAP);
+	
 
 	//////////////////////////////////////////////
 	//
-- 
GitLab