diff --git a/src/common/shared_cache.hpp b/src/common/shared_cache.hpp index df52178607d..2f5f05a0d64 100644 --- a/src/common/shared_cache.hpp +++ b/src/common/shared_cache.hpp @@ -153,8 +153,9 @@ public: bool retry = false; do { retry = false; - if (weak_refs.count(key)) { - val = weak_refs[key].lock(); + typename map::iterator i = weak_refs.find(key); + if (i != weak_refs.end()) { + val = i->second.lock(); if (val) { lru_add(key, val, &to_release); } else {