From 003487631d0715ece515990d6b32b677a122e26b Mon Sep 17 00:00:00 2001
From: Mike Mazur
Date: Wed, 23 Jul 2008 08:03:32 +0000
Subject: Fix issue 1760. If the inventory item is not found, llSay() and throw
 an exception.

---
 .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs  | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

(limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')

diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index f3e9b09..ac4d43a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2770,7 +2770,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
                     break;
                 }
             }
-            
+
+            if (!found)
+            {
+                llSay(0, String.Format("Could not find object '{0}'", inventory));
+                throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory));
+            }
+
             // check if destination is an avatar
             if (World.GetScenePresence(destId) != null)
             {
@@ -2782,9 +2788,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
                 // destination is an object
                 World.MoveTaskInventoryItem(destId, m_host, objId);
             }
-
-            if (!found)
-                llSay(0, "Could not find object " + inventory);
         }
 
         public void llRemoveInventory(string item)
-- 
cgit v1.1