Thank you, tyre, for a patch that fixes a null reference in LSL

function llOverMyLand().
0.6.0-stable
Melanie Thielker 2008-08-13 14:13:46 +00:00
parent 6ccb9948ab
commit e46248ab17
2 changed files with 20 additions and 22 deletions

View File

@ -4241,26 +4241,25 @@ namespace OpenSim.Region.ScriptEngine.Common
public LSL_Types.LSLInteger llOverMyLand(string id) public LSL_Types.LSLInteger llOverMyLand(string id)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
LLUUID key = new LLUUID(); LLUUID key = new LLUUID();
if (LLUUID.TryParse(id,out key)) if (LLUUID.TryParse(id,out key))
{ {
SceneObjectPart obj = new SceneObjectPart(); ScenePresence presence = World.GetScenePresence(key);
obj = World.GetSceneObjectPart(World.Entities[key].LocalId); if (presence != null) // object is an avatar
if (obj.OwnerID == World.GetLandOwner(obj.AbsolutePosition.X, obj.AbsolutePosition.Y))
{ {
return 1; if (m_host.OwnerID == World.GetLandOwner(presence.AbsolutePosition.X, presence.AbsolutePosition.Y))
return 1;
} }
else else // object is not an avatar
{ {
return 0; SceneObjectPart obj = World.GetSceneObjectPart(key);
if (obj != null)
if (m_host.OwnerID == World.GetLandOwner(obj.AbsolutePosition.X, obj.AbsolutePosition.Y))
return 1;
} }
} }
else return 0;
{
return 0;
}
} }
public string llGetLandOwnerAt(LSL_Types.Vector3 pos) public string llGetLandOwnerAt(LSL_Types.Vector3 pos)

View File

@ -4151,26 +4151,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Types.LSLInteger llOverMyLand(string id) public LSL_Types.LSLInteger llOverMyLand(string id)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
LLUUID key = new LLUUID(); LLUUID key = new LLUUID();
if (LLUUID.TryParse(id,out key)) if (LLUUID.TryParse(id,out key))
{ {
SceneObjectPart obj = new SceneObjectPart(); ScenePresence presence = World.GetScenePresence(key);
obj = World.GetSceneObjectPart(World.Entities[key].LocalId); if (presence != null) // object is an avatar
if (obj.OwnerID == World.GetLandOwner(obj.AbsolutePosition.X, obj.AbsolutePosition.Y))
{ {
return 1; if (m_host.OwnerID == World.GetLandOwner(presence.AbsolutePosition.X, presence.AbsolutePosition.Y))
return 1;
} }
else else // object is not an avatar
{ {
return 0; SceneObjectPart obj = World.GetSceneObjectPart(key);
if (obj != null)
if (m_host.OwnerID == World.GetLandOwner(obj.AbsolutePosition.X, obj.AbsolutePosition.Y))
return 1;
} }
} }
else return 0;
{
return 0;
}
} }
public string llGetLandOwnerAt(LSL_Types.Vector3 pos) public string llGetLandOwnerAt(LSL_Types.Vector3 pos)