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

@ -1852,22 +1852,17 @@ namespace OpenSim.Framework.Servers.HttpServer
}
public bool RemoveLLSDHandler(string path, LLSDMethod handler)
{
try
{
lock (m_llsdHandlers)
{
if (handler == m_llsdHandlers[path])
LLSDMethod foundHandler;
if (m_llsdHandlers.TryGetValue(path, out foundHandler) && foundHandler == handler)
{
m_llsdHandlers.Remove(path);
return true;
}
}
}
catch (KeyNotFoundException)
{
// This is an exception to prevent crashing because of invalid code
}
return false;
}