remove necessity to catch a KeyNotFoundException in BaseHttpServer.RemoveLLSDHandler()

bulletsim
Justin Clark-Casey (justincc) 2011-08-22 01:58:19 +01:00
parent 8254116dc6
commit 20a4367827
1 changed files with 6 additions and 11 deletions

View File

@ -1853,21 +1853,16 @@ namespace OpenSim.Framework.Servers.HttpServer
public bool RemoveLLSDHandler(string path, LLSDMethod handler) 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; return false;
} }