diff --git a/src/BasicPathFinding.cs b/src/BasicPathFinding.cs index 8bf7737..74181c2 100644 --- a/src/BasicPathFinding.cs +++ b/src/BasicPathFinding.cs @@ -214,15 +214,21 @@ namespace OpenSim.Modules.PathFinding [ScriptInvocation] public string osCreateNewPathFindingScene(UUID hostID, UUID scriptID) { - SceneObjectGroup _host = m_scene.GetSceneObjectGroup(hostID); + SceneObjectPart _host = m_scene.GetSceneObjectPart(hostID); - String imageName = UUID.Random().ToString(); + if(_host != null) + { + String imageName = UUID.Random().ToString(); - UUID tid = m_asyncCommands.DataserverPlugin.RegisterRequest(_host.LocalId, _host.GroupID, imageName); - - (new Thread(delegate () { createPathFindingScene(imageName); })).Start(); + UUID tid = m_asyncCommands.DataserverPlugin.RegisterRequest(_host.LocalId, _host.GroupID, imageName); + + (new Thread(delegate () { createPathFindingScene(imageName); })).Start(); + + return imageName; + } + + return UUID.Zero.ToString(); - return imageName; } #endregion