From 8d7a69b9621b10f1e675fc393af7e761273f484c Mon Sep 17 00:00:00 2001 From: Christopher Latza Date: Wed, 10 Jun 2020 20:56:28 +0200 Subject: [PATCH] add try --- src/BasicPathFinding.cs | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/BasicPathFinding.cs b/src/BasicPathFinding.cs index e6430f4..9bfce32 100644 --- a/src/BasicPathFinding.cs +++ b/src/BasicPathFinding.cs @@ -223,25 +223,33 @@ namespace OpenSim.Modules.PathFinding [ScriptInvocation] public string osCreateNewPathFindingScene(UUID hostID, UUID scriptID) { - SceneObjectPart _host = m_scene.GetSceneObjectPart(hostID); - - if(_host != null || m_asyncCommands != null) + try { - String imageName = UUID.Random().ToString(); + SceneObjectGroup _host = m_scene.GetSceneObjectGroup(hostID); - UUID tid = m_asyncCommands.DataserverPlugin.RegisterRequest(_host.LocalId, _host.GroupID, imageName); + if (_host != null || m_asyncCommands != null) + { + String imageName = UUID.Random().ToString(); - (new Thread(delegate () { createPathFindingScene(imageName); })).Start(); + UUID tid = m_asyncCommands.DataserverPlugin.RegisterRequest(_host.LocalId, _host.GroupID, imageName); - return imageName; + (new Thread(delegate () { createPathFindingScene(imageName); })).Start(); + + return imageName; + } + else + { + if (_host == null) + m_log.ErrorFormat("[" + Name + "]: Host is null"); + + if (m_asyncCommands == null) + m_log.ErrorFormat("[" + Name + "]: AsyncCommands is null"); + } } - else + catch(Exception _error) { - if (_host == null) - m_log.ErrorFormat("[" + Name + "]: Host is null"); - - if (m_asyncCommands == null) - m_log.ErrorFormat("[" + Name + "]: AsyncCommands is null"); + m_log.Error(_error.Message); + m_log.Error(_error.StackTrace); } return UUID.Zero.ToString();