From 20a4367827d513d9bdafebf6622dc596c2f64879 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 22 Aug 2011 01:58:19 +0100 Subject: remove necessity to catch a KeyNotFoundException in BaseHttpServer.RemoveLLSDHandler() --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 897ee4f..473a01c 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -1853,21 +1853,16 @@ namespace OpenSim.Framework.Servers.HttpServer public bool RemoveLLSDHandler(string path, LLSDMethod handler) { - try + lock (m_llsdHandlers) { - lock (m_llsdHandlers) + LLSDMethod foundHandler; + + if (m_llsdHandlers.TryGetValue(path, out foundHandler) && foundHandler == handler) { - if (handler == m_llsdHandlers[path]) - { - m_llsdHandlers.Remove(path); - return true; - } + m_llsdHandlers.Remove(path); + return true; } } - catch (KeyNotFoundException) - { - // This is an exception to prevent crashing because of invalid code - } return false; } -- cgit v1.1