From a8f3d625cb3ac61b00c01e3f5af015b3d6c88105 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 13 Feb 2009 20:49:23 +0000 Subject: Guard the values used to set the cursor position in the real time console --- OpenSim/Region/Application/OpenSimBase.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Application') diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index f4e28be..914bd7e 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -154,7 +154,9 @@ namespace OpenSim protected override List GetHelpTopics() { List topics = base.GetHelpTopics(); - topics.AddRange(SceneManager.CurrentOrFirstScene.GetCommanders().Keys); + Scene s = SceneManager.CurrentOrFirstScene; + if (s != null && s.GetCommanders() != null) + topics.AddRange(s.GetCommanders().Keys); return topics; } @@ -204,8 +206,15 @@ namespace OpenSim "Execute subcommand for plugin '" + topic + "'", null); - ICommander commander = - SceneManager.CurrentOrFirstScene.GetCommanders()[topic]; + ICommander commander = null; + + Scene s = SceneManager.CurrentOrFirstScene; + + if (s != null && s.GetCommanders() != null) + { + if (s.GetCommanders().ContainsKey(topic)) + commander = s.GetCommanders()[topic]; + } if (commander == null) continue; @@ -227,6 +236,9 @@ namespace OpenSim private void HandleCommanderHelp(string module, string[] cmd) { + // Only safe for the interactive console, since it won't + // let us come here unless both scene and commander exist + // ICommander moduleCommander = SceneManager.CurrentOrFirstScene.GetCommander(cmd[1]); if (moduleCommander != null) m_console.Notice(moduleCommander.Help); -- cgit v1.1