From 9fd9211a3868b78c0fe7a8672d563f5a346dc955 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 28 Nov 2009 09:23:26 +0000 Subject: [PATCH] Add some conditionals to references to the WorldComm module, so that the module can be disabled without crashing the sim --- .../Api/Implementation/AsyncCommandManager.cs | 3 ++- .../Shared/Api/Implementation/LSL_Api.cs | 23 +++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs index 9d97cb2fd5..ee32755a0b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs @@ -236,7 +236,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api iHttpReq.StopHttpRequest(localID, itemID); IWorldComm comms = engine.World.RequestModuleInterface(); - comms.DeleteListener(itemID); + if (comms != null) + comms.DeleteListener(itemID); IXMLRPC xmlrpc = engine.World.RequestModuleInterface(); xmlrpc.DeleteChannels(itemID); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index f5cda2cbbb..d235bacb23 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -734,7 +734,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ChatTypeEnum.Whisper, channelID, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, false); IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); - wComm.DeliverMessage(ChatTypeEnum.Whisper, channelID, m_host.Name, m_host.UUID, text); + if (wComm != null) + wComm.DeliverMessage(ChatTypeEnum.Whisper, channelID, m_host.Name, m_host.UUID, text); } public void llSay(int channelID, string text) @@ -754,7 +755,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ChatTypeEnum.Say, channelID, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, false); IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); - wComm.DeliverMessage(ChatTypeEnum.Say, channelID, m_host.Name, m_host.UUID, text); + if (wComm != null) + wComm.DeliverMessage(ChatTypeEnum.Say, channelID, m_host.Name, m_host.UUID, text); } } @@ -769,7 +771,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ChatTypeEnum.Shout, channelID, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, true); IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); - wComm.DeliverMessage(ChatTypeEnum.Shout, channelID, m_host.Name, m_host.UUID, text); + if (wComm != null) + wComm.DeliverMessage(ChatTypeEnum.Shout, channelID, m_host.Name, m_host.UUID, text); } public void llRegionSay(int channelID, string text) @@ -786,7 +789,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); - wComm.DeliverMessage(ChatTypeEnum.Region, channelID, m_host.Name, m_host.UUID, text); + if (wComm != null) + wComm.DeliverMessage(ChatTypeEnum.Region, channelID, m_host.Name, m_host.UUID, text); } public LSL_Integer llListen(int channelID, string name, string ID, string msg) @@ -795,21 +799,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID keyID; UUID.TryParse(ID, out keyID); IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); - return wComm.Listen(m_localID, m_itemID, m_host.UUID, channelID, name, keyID, msg); + if (wComm != null) + return wComm.Listen(m_localID, m_itemID, m_host.UUID, channelID, name, keyID, msg); + else + return -1; } public void llListenControl(int number, int active) { m_host.AddScriptLPS(1); IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); - wComm.ListenControl(m_itemID, number, active); + if (wComm != null) + wComm.ListenControl(m_itemID, number, active); } public void llListenRemove(int number) { m_host.AddScriptLPS(1); IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); - wComm.ListenRemove(m_itemID, number); + if (wComm != null) + wComm.ListenRemove(m_itemID, number); } public void llSensor(string name, string id, int type, double range, double arc)