check for null target, minor cleanup

0.9.0-post-fixes
UbitUmarov 2016-09-21 22:51:25 +01:00
parent 874ba6b363
commit bf17da3d61
1 changed files with 13 additions and 12 deletions

View File

@ -374,9 +374,11 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
if (channel == DEBUG_CHANNEL) if (channel == DEBUG_CHANNEL)
return; return;
// Is id an avatar? if(target == UUID.Zero)
ScenePresence sp = m_scene.GetScenePresence(target); return;
// Is target an avatar?
ScenePresence sp = m_scene.GetScenePresence(target);
if (sp != null) if (sp != null)
{ {
// Send message to avatar // Send message to avatar
@ -407,13 +409,13 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
// Need to check each attachment // Need to check each attachment
foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg))
{ {
if (li.GetHostID().Equals(id)) UUID liHostID = li.GetHostID();
if (liHostID.Equals(id))
continue;
if (m_scene.GetSceneObjectPart(liHostID) == null)
continue; continue;
if (m_scene.GetSceneObjectPart(li.GetHostID()) == null) if (targets.Contains(liHostID))
continue;
if (targets.Contains(li.GetHostID()))
QueueMessage(new ListenerInfo(li, name, id, msg)); QueueMessage(new ListenerInfo(li, name, id, msg));
} }
@ -426,16 +428,15 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg))
{ {
UUID liHostID = li.GetHostID();
// Dont process if this message is from yourself! // Dont process if this message is from yourself!
if (li.GetHostID().Equals(id)) if (liHostID.Equals(id))
continue; continue;
SceneObjectPart sPart = m_scene.GetSceneObjectPart( if (m_scene.GetSceneObjectPart(liHostID) == null)
li.GetHostID());
if (sPart == null)
continue; continue;
if (li.GetHostID().Equals(target)) if (liHostID.Equals(target))
{ {
QueueMessage(new ListenerInfo(li, name, id, msg)); QueueMessage(new ListenerInfo(li, name, id, msg));
break; break;