summaryrefslogtreecommitdiff
path: root/indra/newview/llvosky.cpp
diff options
context:
space:
mode:
authormaksymsproductengine <maksymsproductengine@lindenlab.com>2014-03-20 19:21:52 +0200
committermaksymsproductengine <maksymsproductengine@lindenlab.com>2014-03-20 19:21:52 +0200
commit6f33f9090b554a32f039e46d8177650ccbf94536 (patch)
tree3d518c0a2ec73a88c5cd0c99d900e98c035b8756 /indra/newview/llvosky.cpp
parent2f606a36f63979af73bad76d883646b2d3f8a727 (diff)
MAINT-3827 FIXED crash in KDU texture decoding, likely out of memory
Diffstat (limited to 'indra/newview/llvosky.cpp')
-rwxr-xr-xindra/newview/llvosky.cpp39
1 files changed, 23 insertions, 16 deletions
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index 93f0e50336..467152881e 100755
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -257,18 +257,21 @@ LLSkyTex::~LLSkyTex()
void LLSkyTex::initEmpty(const S32 tex)
{
U8* data = mImageRaw[tex]->getData();
- for (S32 i = 0; i < sResolution; ++i)
+ if (data)
{
- for (S32 j = 0; j < sResolution; ++j)
+ for (S32 i = 0; i < sResolution; ++i)
{
- 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;
+ 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();
+ mSkyData[basic_offset].setToBlack();
+ }
}
}
@@ -279,17 +282,21 @@ void LLSkyTex::create(const F32 brightness)
{
/// Brightness ignored for now.
U8* data = mImageRaw[sCurrent]->getData();
- for (S32 i = 0; i < sResolution; ++i)
+ if (data)
{
- for (S32 j = 0; j < sResolution; ++j)
+ for (S32 i = 0; i < sResolution; ++i)
{
- 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;
+ 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;
+ }
}
}
+
createGLImage(sCurrent);
}