diff options
author | Teravus Ovares | 2009-04-13 16:06:53 +0000 |
---|---|---|
committer | Teravus Ovares | 2009-04-13 16:06:53 +0000 |
commit | bd7d00db337dd197a212660791ef5ad867fcbd97 (patch) | |
tree | d60a506aa82e520ab1d380dc4ee09842d38a28d6 | |
parent | *Bypass J2kDecoder when asset is null (diff) | |
download | opensim-SC-bd7d00db337dd197a212660791ef5ad867fcbd97.zip opensim-SC-bd7d00db337dd197a212660791ef5ad867fcbd97.tar.gz opensim-SC-bd7d00db337dd197a212660791ef5ad867fcbd97.tar.bz2 opensim-SC-bd7d00db337dd197a212660791ef5ad867fcbd97.tar.xz |
* 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?)
-rw-r--r-- | OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs | 16 |
1 files changed, 14 insertions, 2 deletions
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 | |||
223 | // Try to do some heuristics error correction! Yeah. | 223 | // Try to do some heuristics error correction! Yeah. |
224 | bool sane2Heuristics = true; | 224 | bool sane2Heuristics = true; |
225 | 225 | ||
226 | if (texture.LayerInfo.Length == 0) | 226 | |
227 | if (texture.Image == null) | ||
228 | sane2Heuristics = false; | ||
229 | |||
230 | if (texture.LayerInfo == null) | ||
227 | sane2Heuristics = false; | 231 | sane2Heuristics = false; |
228 | 232 | ||
229 | if (sane2Heuristics) | 233 | if (sane2Heuristics) |
230 | { | 234 | { |
235 | |||
236 | |||
237 | if (texture.LayerInfo.Length == 0) | ||
238 | sane2Heuristics = false; | ||
239 | } | ||
240 | |||
241 | if (sane2Heuristics) | ||
242 | { | ||
231 | // Last layer start is less then the end of the file and last layer start is greater then 0 | 243 | // Last layer start is less then the end of the file and last layer start is greater then 0 |
232 | if (texture.LayerInfo[texture.LayerInfo.Length - 1].Start < texture.AssetData.Length && texture.LayerInfo[texture.LayerInfo.Length - 1].Start > 0) | 244 | if (texture.LayerInfo[texture.LayerInfo.Length - 1].Start < texture.AssetData.Length && texture.LayerInfo[texture.LayerInfo.Length - 1].Start > 0) |
233 | { | 245 | { |
@@ -292,7 +304,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
292 | } | 304 | } |
293 | else | 305 | else |
294 | { | 306 | { |
295 | m_log.WarnFormat("[J2KDecoderModule]: JPEG2000 texture decoding failed for {0}", AssetId); | 307 | m_log.WarnFormat("[J2KDecoderModule]: JPEG2000 texture decoding failed for {0}. Is this a texture? is it J2K?", AssetId); |
296 | } | 308 | } |
297 | } | 309 | } |
298 | texture = null; // dereference and dispose of ManagedImage | 310 | texture = null; // dereference and dispose of ManagedImage |