diff options
author | Justin Clark-Casey (justincc) | 2011-11-22 22:13:57 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-11-22 22:13:57 +0000 |
commit | b0fe0464af9a11dda184d3613eca734cd8c9f21e (patch) | |
tree | 27a8a50451c139f954d86d4348ca6e10a552c34e /OpenSim/Region | |
parent | slightly simplify OdeScene.Simulate() by removing bool processtaints, since w... (diff) | |
download | opensim-SC_OLD-b0fe0464af9a11dda184d3613eca734cd8c9f21e.zip opensim-SC_OLD-b0fe0464af9a11dda184d3613eca734cd8c9f21e.tar.gz opensim-SC_OLD-b0fe0464af9a11dda184d3613eca734cd8c9f21e.tar.bz2 opensim-SC_OLD-b0fe0464af9a11dda184d3613eca734cd8c9f21e.tar.xz |
Stop an exception being thrown and a teleport/border cross failing if the desintation sim has no active script engines.
This involves getting IScene.RequestModuleInterfaces() to return an empty array (as was stated in the method doc) rather than an array containing one null entry.
Callers adjusted to stop checking for the list reference being null (which never happened anyway)
Diffstat (limited to '')
4 files changed, 22 insertions, 29 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 663aa22..26eb729 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -82,16 +82,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
82 | m_log.Info("[PRIM INVENTORY]: Starting scripts in scene"); | 82 | m_log.Info("[PRIM INVENTORY]: Starting scripts in scene"); |
83 | 83 | ||
84 | IScriptModule[] engines = RequestModuleInterfaces<IScriptModule>(); | 84 | IScriptModule[] engines = RequestModuleInterfaces<IScriptModule>(); |
85 | if (engines != null) | 85 | |
86 | { | 86 | foreach (IScriptModule engine in engines) |
87 | foreach (IScriptModule engine in engines) | 87 | engine.StartProcessing(); |
88 | { | ||
89 | if (engine != null) | ||
90 | { | ||
91 | engine.StartProcessing(); | ||
92 | } | ||
93 | } | ||
94 | } | ||
95 | } | 88 | } |
96 | 89 | ||
97 | public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item) | 90 | public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index dee2ecb..0336fe5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs | |||
@@ -449,7 +449,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
449 | } | 449 | } |
450 | else | 450 | else |
451 | { | 451 | { |
452 | return new T[] { default(T) }; | 452 | return new T[] {}; |
453 | } | 453 | } |
454 | } | 454 | } |
455 | 455 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 9446741..d80944b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -232,8 +232,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
232 | ArrayList ret = new ArrayList(); | 232 | ArrayList ret = new ArrayList(); |
233 | 233 | ||
234 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | 234 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); |
235 | if (engines == null) // No engine at all | ||
236 | return ret; | ||
237 | 235 | ||
238 | foreach (IScriptModule e in engines) | 236 | foreach (IScriptModule e in engines) |
239 | { | 237 | { |
@@ -329,7 +327,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
329 | private void RestoreSavedScriptState(UUID oldID, UUID newID) | 327 | private void RestoreSavedScriptState(UUID oldID, UUID newID) |
330 | { | 328 | { |
331 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | 329 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); |
332 | if (engines == null) // No engine at all | 330 | if (engines.Length == 0) // No engine at all |
333 | return; | 331 | return; |
334 | 332 | ||
335 | if (m_part.ParentGroup.m_savedScriptState.ContainsKey(oldID)) | 333 | if (m_part.ParentGroup.m_savedScriptState.ContainsKey(oldID)) |
@@ -369,6 +367,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
369 | 367 | ||
370 | m_part.ParentGroup.m_savedScriptState[oldID] = newDoc.OuterXml; | 368 | m_part.ParentGroup.m_savedScriptState[oldID] = newDoc.OuterXml; |
371 | } | 369 | } |
370 | |||
372 | foreach (IScriptModule e in engines) | 371 | foreach (IScriptModule e in engines) |
373 | { | 372 | { |
374 | if (e != null) | 373 | if (e != null) |
@@ -377,6 +376,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
377 | break; | 376 | break; |
378 | } | 377 | } |
379 | } | 378 | } |
379 | |||
380 | m_part.ParentGroup.m_savedScriptState.Remove(oldID); | 380 | m_part.ParentGroup.m_savedScriptState.Remove(oldID); |
381 | } | 381 | } |
382 | } | 382 | } |
@@ -1129,7 +1129,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1129 | 1129 | ||
1130 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | 1130 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); |
1131 | 1131 | ||
1132 | if (engines == null) // No engine at all | 1132 | if (engines.Length == 0) // No engine at all |
1133 | return ret; | 1133 | return ret; |
1134 | 1134 | ||
1135 | List<TaskInventoryItem> scripts = GetInventoryScripts(); | 1135 | List<TaskInventoryItem> scripts = GetInventoryScripts(); |
@@ -1157,7 +1157,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1157 | public void ResumeScripts() | 1157 | public void ResumeScripts() |
1158 | { | 1158 | { |
1159 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | 1159 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); |
1160 | if (engines == null) | 1160 | if (engines.Length == 0) |
1161 | return; | 1161 | return; |
1162 | 1162 | ||
1163 | List<TaskInventoryItem> scripts = GetInventoryScripts(); | 1163 | List<TaskInventoryItem> scripts = GetInventoryScripts(); |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7d901c9..c2d3501 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -3525,23 +3525,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
3525 | /// <param name="args">The arguments for the event</param> | 3525 | /// <param name="args">The arguments for the event</param> |
3526 | public void SendScriptEventToAttachments(string eventName, Object[] args) | 3526 | public void SendScriptEventToAttachments(string eventName, Object[] args) |
3527 | { | 3527 | { |
3528 | if (m_scriptEngines != null) | 3528 | if (m_scriptEngines.Length == 0) |
3529 | return; | ||
3530 | |||
3531 | lock (m_attachments) | ||
3529 | { | 3532 | { |
3530 | lock (m_attachments) | 3533 | foreach (SceneObjectGroup grp in m_attachments) |
3531 | { | 3534 | { |
3532 | foreach (SceneObjectGroup grp in m_attachments) | 3535 | // 16384 is CHANGED_ANIMATION |
3536 | // | ||
3537 | // Send this to all attachment root prims | ||
3538 | // | ||
3539 | foreach (IScriptModule m in m_scriptEngines) | ||
3533 | { | 3540 | { |
3534 | // 16384 is CHANGED_ANIMATION | 3541 | if (m == null) // No script engine loaded |
3535 | // | 3542 | continue; |
3536 | // Send this to all attachment root prims | ||
3537 | // | ||
3538 | foreach (IScriptModule m in m_scriptEngines) | ||
3539 | { | ||
3540 | if (m == null) // No script engine loaded | ||
3541 | continue; | ||
3542 | 3543 | ||
3543 | m.PostObjectEvent(grp.RootPart.UUID, "changed", new Object[] { (int)Changed.ANIMATION }); | 3544 | m.PostObjectEvent(grp.RootPart.UUID, "changed", new Object[] { (int)Changed.ANIMATION }); |
3544 | } | ||
3545 | } | 3545 | } |
3546 | } | 3546 | } |
3547 | } | 3547 | } |