From 8e00e933a47c583e1016dd164e50c49d4db57167 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 22 Sep 2008 20:09:06 +0000 Subject: * Apply http://opensimulator.org/mantis/view.php?id=2234 * Exceptions can thrown by llGetOwnerKey() * Thanks idb --- OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 13 ++++++++++++- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 679b9b8..90cd3b1 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -3957,7 +3957,18 @@ namespace OpenSim.Region.ScriptEngine.Common UUID key = new UUID(); if (UUID.TryParse(id, out key)) { - return World.GetSceneObjectPart(World.Entities[key].LocalId).OwnerID.ToString(); + try + { + SceneObjectPart obj = World.GetSceneObjectPart(World.Entities[key].LocalId); + if (obj == null) + return id; // the key is for an agent so just return the key + else + return obj.OwnerID.ToString(); + } + catch (KeyNotFoundException) + { + return id; // The Object/Agent is not in the region so just return the key + } } else { diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index d2cfdca..110ece4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3815,7 +3815,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID key = new UUID(); if (UUID.TryParse(id, out key)) { - return World.GetSceneObjectPart(World.Entities[key].LocalId).OwnerID.ToString(); + try + { + SceneObjectPart obj = World.GetSceneObjectPart(World.Entities[key].LocalId); + if (obj == null) + return id; // the key is for an agent so just return the key + else + return obj.OwnerID.ToString(); + } + catch (KeyNotFoundException) + { + return id; // The Object/Agent not in the region so just return the key + } } else { -- cgit v1.1