Mantis 7833: Fix a condition where email sent from an object that is in

the process of being removed can cause a null reference
LSLKeyTest
Melanie Thielker 2016-03-03 17:08:56 +01:00
parent ab12a14279
commit c541b5cf43
1 changed files with 8 additions and 11 deletions

View File

@ -224,8 +224,9 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
return null;
}
private void resolveNamePositionRegionName(UUID objectID, out string ObjectName, out string ObjectAbsolutePosition, out string ObjectRegionName)
private bool resolveNamePositionRegionName(UUID objectID, out string ObjectName, out string ObjectAbsolutePosition, out string ObjectRegionName)
{
ObjectName = ObjectAbsolutePosition = ObjectRegionName = String.Empty;
string m_ObjectRegionName;
int objectLocX;
int objectLocY;
@ -239,15 +240,9 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
ObjectAbsolutePosition = "(" + objectLocX + ", " + objectLocY + ", " + objectLocZ + ")";
ObjectName = part.Name;
ObjectRegionName = m_ObjectRegionName;
return;
return true;
}
objectLocX = (int)part.AbsolutePosition.X;
objectLocY = (int)part.AbsolutePosition.Y;
objectLocZ = (int)part.AbsolutePosition.Z;
ObjectAbsolutePosition = "(" + objectLocX + ", " + objectLocY + ", " + objectLocZ + ")";
ObjectName = part.Name;
ObjectRegionName = m_ObjectRegionName;
return;
return false;
}
/// <summary>
@ -286,7 +281,8 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
string LastObjectPosition = string.Empty;
string LastObjectRegionName = string.Empty;
resolveNamePositionRegionName(objectID, out LastObjectName, out LastObjectPosition, out LastObjectRegionName);
if (!resolveNamePositionRegionName(objectID, out LastObjectName, out LastObjectPosition, out LastObjectRegionName))
return;
if (!address.EndsWith(m_InterObjectHostname))
{
@ -302,7 +298,8 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
//Subject
emailMessage.Subject = subject;
//TEXT Body
resolveNamePositionRegionName(objectID, out LastObjectName, out LastObjectPosition, out LastObjectRegionName);
if (!resolveNamePositionRegionName(objectID, out LastObjectName, out LastObjectPosition, out LastObjectRegionName))
return;
emailMessage.BodyText = "Object-Name: " + LastObjectName +
"\nRegion: " + LastObjectRegionName + "\nLocal-Position: " +
LastObjectPosition + "\n\n" + body;