From 98cdc1efddd5fb34537473cd2ae9beae020f585d Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 29 Apr 2009 20:32:40 +0000 Subject: Fix a crash that will hit when an image asset is truncated in storage --- OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs index 0727da5..e72cdab 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs @@ -103,7 +103,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (!m_decoded) return 0; - return (ushort)(((m_asset.Data.Length - cFirstPacketSize + cImagePacketSize - 1) / cImagePacketSize) + 1); + try + { + return (ushort)(((m_asset.Data.Length - cFirstPacketSize + cImagePacketSize - 1) / cImagePacketSize) + 1); + } + catch(Exception e) + { + // If the asset is missing/destroyed/truncated, we will land + // here + // + return 0; + } } public void J2KDecodedCallback(UUID AssetId, OpenJPEG.J2KLayerInfo[] layers) -- cgit v1.1