From b0fe0464af9a11dda184d3613eca734cd8c9f21e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 22 Nov 2011 22:13:57 +0000 Subject: 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) --- OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs') 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 ArrayList ret = new ArrayList(); IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces(); - if (engines == null) // No engine at all - return ret; foreach (IScriptModule e in engines) { @@ -329,7 +327,7 @@ namespace OpenSim.Region.Framework.Scenes private void RestoreSavedScriptState(UUID oldID, UUID newID) { IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces(); - if (engines == null) // No engine at all + if (engines.Length == 0) // No engine at all return; if (m_part.ParentGroup.m_savedScriptState.ContainsKey(oldID)) @@ -369,6 +367,7 @@ namespace OpenSim.Region.Framework.Scenes m_part.ParentGroup.m_savedScriptState[oldID] = newDoc.OuterXml; } + foreach (IScriptModule e in engines) { if (e != null) @@ -377,6 +376,7 @@ namespace OpenSim.Region.Framework.Scenes break; } } + m_part.ParentGroup.m_savedScriptState.Remove(oldID); } } @@ -1129,7 +1129,7 @@ namespace OpenSim.Region.Framework.Scenes IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces(); - if (engines == null) // No engine at all + if (engines.Length == 0) // No engine at all return ret; List scripts = GetInventoryScripts(); @@ -1157,7 +1157,7 @@ namespace OpenSim.Region.Framework.Scenes public void ResumeScripts() { IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces(); - if (engines == null) + if (engines.Length == 0) return; List scripts = GetInventoryScripts(); -- cgit v1.1