From ce011d7e446e8f05247fc4ed7e0af5a94afbb074 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Tue, 23 Aug 2011 10:52:12 -0700 Subject: [PATCH] Protect a check for default texture entry when setting alpha values. Apparently if all faces have their own textures then the default texture is null --- .../Shared/Api/Implementation/LSL_Api.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ef67a0cefb..24be7d423b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1619,9 +1619,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api tex.FaceTextures[i].RGBA = texcolor; } } - texcolor = tex.DefaultTexture.RGBA; - texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); - tex.DefaultTexture.RGBA = texcolor; + + // In some cases, the default texture can be null, eg when every face + // has a unique texture + if (tex.DefaultTexture != null) + { + texcolor = tex.DefaultTexture.RGBA; + texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); + tex.DefaultTexture.RGBA = texcolor; + } + part.UpdateTexture(tex); return; }