diff options
-rw-r--r-- | cppu/source/uno/EnvStack.cxx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cppu/source/uno/EnvStack.cxx b/cppu/source/uno/EnvStack.cxx index cafd4fe23b75..22d7bd992909 100644 --- a/cppu/source/uno/EnvStack.cxx +++ b/cppu/source/uno/EnvStack.cxx @@ -74,10 +74,15 @@ static void s_setCurrent(uno_Environment * pEnv) osl::MutexGuard guard(s_threadMap_mutex::get()); ThreadMap &rThreadMap = s_threadMap::get(); if (pEnv) + { rThreadMap[threadId] = pEnv; - + } else - rThreadMap.erase(threadId); + { + ThreadMap::iterator iEnv = rThreadMap.find(threadId); + if( iEnv != rThreadMap.end()) + rThreadMap.erase(iEnv); + } } static uno_Environment * s_getCurrent(void) |