diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index bf2db58b36..c260fb2f0c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2966,10 +2966,12 @@ namespace OpenSim.Region.Framework.Scenes try { ScenePresence sp = GetScenePresence(agentID); - PresenceService.LogoutAgent(sp.ControllingClient.SessionId); - + if (sp != null) + { + PresenceService.LogoutAgent(sp.ControllingClient.SessionId); sp.ControllingClient.Close(); + } // BANG! SLASH! m_authenticateHandler.RemoveCircuit(agentID);