avoid a null ref

0.9.1.1
UbitUmarov 2019-11-07 03:00:56 +00:00
parent 8ed0680bb9
commit bd9f6ae3f0
1 changed files with 23 additions and 11 deletions

View File

@ -78,10 +78,12 @@ namespace OpenSim.Region.Framework.Scenes
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// ~ScenePresence() public int MaxNumberAttachments { get; } = 38; // per viewers limit
// {
// m_log.DebugFormat("[SCENE PRESENCE]: Destructor called on {0}", Name); // ~ScenePresence()
// } // {
// m_log.DebugFormat("[SCENE PRESENCE]: Destructor called on {0}", Name);
// }
public void TriggerScenePresenceUpdated() public void TriggerScenePresenceUpdated()
{ {
@ -303,7 +305,11 @@ namespace OpenSim.Region.Framework.Scenes
public bool Flying public bool Flying
{ {
get { return PhysicsActor != null && PhysicsActor.Flying; } get { return PhysicsActor != null && PhysicsActor.Flying; }
set { PhysicsActor.Flying = value; } set
{
if(PhysicsActor != null)
PhysicsActor.Flying = value;
}
} }
public bool IsColliding public bool IsColliding
@ -5406,6 +5412,12 @@ namespace OpenSim.Region.Framework.Scenes
bakedModule.UpdateMeshAvatar(m_uuid); bakedModule.UpdateMeshAvatar(m_uuid);
} }
public int GetAttachmentsCount()
{
return m_attachments.Count;
}
/// <summary> /// <summary>
/// Get all the presence's attachments. /// Get all the presence's attachments.
/// </summary> /// </summary>
@ -6605,10 +6617,9 @@ namespace OpenSim.Region.Framework.Scenes
if (m_lastColliders.Count == 0) if (m_lastColliders.Count == 0)
return; // nothing to do return; // nothing to do
foreach (uint localID in m_lastColliders) for(int i = 0; i < m_lastColliders.Count; ++i)
{ endedColliders.Add(m_lastColliders[i]);
endedColliders.Add(localID);
}
m_lastColliders.Clear(); m_lastColliders.Clear();
} }
else else
@ -6668,9 +6679,10 @@ namespace OpenSim.Region.Framework.Scenes
if (soundinfolist.Count > 0) if (soundinfolist.Count > 0)
CollisionSounds.AvatarCollisionSound(this, soundinfolist); CollisionSounds.AvatarCollisionSound(this, soundinfolist);
} }
List<SceneObjectGroup> attachements = GetAttachments();
foreach (SceneObjectGroup att in GetAttachments()) for (int i = 0; i< attachements.Count; ++i)
{ {
SceneObjectGroup att = attachements[i];
SendCollisionEvent(att, scriptEvents.collision_start, startedColliders, m_scene.EventManager.TriggerScriptCollidingStart); SendCollisionEvent(att, scriptEvents.collision_start, startedColliders, m_scene.EventManager.TriggerScriptCollidingStart);
SendCollisionEvent(att, scriptEvents.collision , m_lastColliders , m_scene.EventManager.TriggerScriptColliding); SendCollisionEvent(att, scriptEvents.collision , m_lastColliders , m_scene.EventManager.TriggerScriptColliding);
SendCollisionEvent(att, scriptEvents.collision_end , endedColliders , m_scene.EventManager.TriggerScriptCollidingEnd); SendCollisionEvent(att, scriptEvents.collision_end , endedColliders , m_scene.EventManager.TriggerScriptCollidingEnd);