From bd7d00db337dd197a212660791ef5ad867fcbd97 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Mon, 13 Apr 2009 16:06:53 +0000 Subject: * Remove null reference exception in the J2KDecoderModule's J2K repair routine for when the asset we're looking up isn't an image at all. (did someone set the texture on the side of a primitive to some other kind of asset with the script engine?) --- .../CoreModules/Agent/TextureSender/J2KDecoderModule.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index 3343204..cf9a240 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs @@ -223,11 +223,23 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender // Try to do some heuristics error correction! Yeah. bool sane2Heuristics = true; - if (texture.LayerInfo.Length == 0) + + if (texture.Image == null) + sane2Heuristics = false; + + if (texture.LayerInfo == null) sane2Heuristics = false; if (sane2Heuristics) { + + + if (texture.LayerInfo.Length == 0) + sane2Heuristics = false; + } + + if (sane2Heuristics) + { // Last layer start is less then the end of the file and last layer start is greater then 0 if (texture.LayerInfo[texture.LayerInfo.Length - 1].Start < texture.AssetData.Length && texture.LayerInfo[texture.LayerInfo.Length - 1].Start > 0) { @@ -292,7 +304,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender } else { - m_log.WarnFormat("[J2KDecoderModule]: JPEG2000 texture decoding failed for {0}", AssetId); + m_log.WarnFormat("[J2KDecoderModule]: JPEG2000 texture decoding failed for {0}. Is this a texture? is it J2K?", AssetId); } } texture = null; // dereference and dispose of ManagedImage -- cgit v1.1