avoid potencial null ref
parent
d2dbe3f4d0
commit
182b266ec4
|
@ -3984,7 +3984,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
// We need to ensure that we are not already removing the scene presence before we ask it not to be
|
||||
// closed.
|
||||
if (sp != null && sp.IsChildAgent
|
||||
if (sp != null && !sp.IsDeleted && sp.IsChildAgent
|
||||
&& (sp.LifecycleState == ScenePresenceState.Running
|
||||
|| sp.LifecycleState == ScenePresenceState.PreRemove))
|
||||
{
|
||||
|
@ -4033,10 +4033,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
const int pollInterval = 1000;
|
||||
int pollsLeft = polls;
|
||||
|
||||
while (sp.LifecycleState == ScenePresenceState.Removing && pollsLeft-- > 0)
|
||||
try
|
||||
{
|
||||
while (!sp.IsDeleted && sp.LifecycleState == ScenePresenceState.Removing && pollsLeft-- > 0)
|
||||
Thread.Sleep(pollInterval);
|
||||
|
||||
if (sp.LifecycleState == ScenePresenceState.Removing)
|
||||
if (!sp.IsDeleted && sp.LifecycleState == ScenePresenceState.Removing)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[SCENE]: Agent {0} in {1} was still being removed after {2}s. Aborting NewUserConnection.",
|
||||
|
@ -4051,10 +4053,18 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
sp.Name, Name, polls * pollInterval / 1000);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
sp = null;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: can we remove this lock?
|
||||
lock (m_newUserConnLock)
|
||||
{
|
||||
if(sp != null && sp.IsDeleted)
|
||||
sp = null;
|
||||
|
||||
if (sp != null && !sp.IsChildAgent)
|
||||
{
|
||||
// We have a root agent. Is it in transit?
|
||||
|
|
Loading…
Reference in New Issue