Prevent nullrefs in scene object deletion. Mantis #5156

viewer-2-initial-appearance
Melanie 2010-10-27 20:47:27 +01:00
parent a4e95c0717
commit 1fcac7203d
1 changed files with 4 additions and 1 deletions

View File

@ -406,11 +406,14 @@ namespace OpenSim.Region.Framework.Scenes
public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked)
{
EntityBase entity;
if (!Entities.TryGetValue(uuid, out entity) && entity is SceneObjectGroup)
if (!Entities.TryGetValue(uuid, out entity) || (!(entity is SceneObjectGroup)))
return false;
SceneObjectGroup grp = (SceneObjectGroup)entity;
if (entity == null)
return false;
if (!resultOfObjectLinked)
{
m_numPrim -= grp.PrimCount;