diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index 3343204840..cf9a24001a 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs @@ -223,9 +223,21 @@ 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 @@ -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