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 --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') 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