Trying to avoid the null pointer exception in J2KImage, RunUpdate.

prioritization
Diva Canto 2009-10-04 07:41:10 -07:00
parent 95ebb7794c
commit 366bfe17ae
1 changed files with 9 additions and 1 deletions

View File

@ -158,9 +158,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_currentPacket = m_stopPacket;
return;
}
if (DiscardLevel >= 0 || m_stopPacket == 0)
{
// This shouldn't happen, but if it does, we really can't proceed
if (Layers == null)
{
m_log.Warn("[J2KIMAGE]: RunUpdate() called with missing Layers. Canceling texture transfer");
m_currentPacket = m_stopPacket;
return;
}
int maxDiscardLevel = Math.Max(0, Layers.Length - 1);
// Treat initial texture downloads with a DiscardLevel of -1 a request for the highest DiscardLevel