avoid null ref

This commit is contained in:
UbitUmarov
2022-02-23 13:38:13 +00:00
parent b6874f50ff
commit 9a897683f4
3 changed files with 10 additions and 1 deletions

View File

@@ -1412,6 +1412,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
public virtual void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm, Vector3 lookAt)
{
if (lm == null || lm.Data == null || lm.Data.Length == 0)
return;
ScenePresence sp = Scene.GetScenePresence(remoteClient.AgentId);
if (sp == null || sp.IsDeleted || sp.IsInTransit || sp.IsChildAgent || sp.IsNPC)
return;

View File

@@ -543,6 +543,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
/// <param name="position"></param>
public override void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm, Vector3 lookAt)
{
if (lm == null || lm.Data == null || lm.Data.Length == 0)
return;
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Teleporting agent via landmark to {0} region {1} position {2}",
(string.IsNullOrEmpty(lm.Gatekeeper)) ? "local" : lm.Gatekeeper, lm.RegionID, lm.Position);
@@ -595,7 +598,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
GatekeeperServiceConnector gConn = new GatekeeperServiceConnector();
GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, lm.RegionID, remoteClient.AgentId, homeURI, out string message);
if(finalDestination == null)
{
remoteClient.SendTeleportFailed(message);
return;
}
// Validate assorted conditions
if (!ValidateGenericConditions(sp, gatekeeper, finalDestination, 0, out string reason))