From 831c7a27ffe3a4d8229dc8b4e49930ce18fdb910 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Thu, 17 May 2007 13:46:26 +0000 Subject: [PATCH] * did the try get thing and introduced some variables for readability --- OpenSim/OpenSimMain.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/OpenSim/OpenSimMain.cs b/OpenSim/OpenSimMain.cs index 0b614f80f7..e90ad54239 100644 --- a/OpenSim/OpenSimMain.cs +++ b/OpenSim/OpenSimMain.cs @@ -277,11 +277,16 @@ namespace OpenSim agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); agent_data.startpos = new LLVector3(Single.Parse((string)requestData["pos_x"]), Single.Parse((string)requestData["pos_y"]), Single.Parse((string)requestData["pos_z"])); - if (((RemoteGridBase)this.GridServers.GridServer).agentcircuits.ContainsKey((uint)agent_data.circuitcode)) + uint circuitcode = (uint)agent_data.circuitcode; + RemoteGridBase gridServer = (RemoteGridBase)this.GridServers.GridServer; + + AgentCircuitData agentCircuit; + + if (gridServer.agentcircuits.TryGetValue(circuitcode, out agentCircuit)) { - ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[(uint)agent_data.circuitcode].firstname = agent_data.firstname; - ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[(uint)agent_data.circuitcode].lastname = agent_data.lastname; - ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[(uint)agent_data.circuitcode].startpos = agent_data.startpos; + agentCircuit.firstname = agent_data.firstname; + agentCircuit.lastname = agent_data.lastname; + agentCircuit.startpos = agent_data.startpos; } return new XmlRpcResponse();