Fix a crash that will hit when an image asset is truncated in storage

0.6.5-rc1
Melanie Thielker 2009-04-29 20:32:40 +00:00
parent 10415c579b
commit 98cdc1efdd
1 changed files with 11 additions and 1 deletions

View File

@ -103,7 +103,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
if (!m_decoded) if (!m_decoded)
return 0; 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) public void J2KDecodedCallback(UUID AssetId, OpenJPEG.J2KLayerInfo[] layers)