diff --git a/server/WebApi.cpp b/server/WebApi.cpp index 7d26214e..278d524f 100755 --- a/server/WebApi.cpp +++ b/server/WebApi.cpp @@ -330,8 +330,17 @@ public: } size_t erase(const std::string &key) { - std::lock_guard lck(_mtx); - return _map.erase(key); + Pointer erase_ptr; + { + std::lock_guard lck(_mtx); + auto itr = _map.find(key); + if (itr != _map.end()) { + erase_ptr = itr->second; + _map.erase(itr); + return 1; + } + } + return 0; } size_t size() {