diff options
Diffstat (limited to 'services/camera/libcameraservice/utils/ClientManager.h')
-rw-r--r-- | services/camera/libcameraservice/utils/ClientManager.h | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/services/camera/libcameraservice/utils/ClientManager.h b/services/camera/libcameraservice/utils/ClientManager.h index aa40a2d..5afb7a3 100644 --- a/services/camera/libcameraservice/utils/ClientManager.h +++ b/services/camera/libcameraservice/utils/ClientManager.h @@ -432,15 +432,17 @@ std::vector<std::shared_ptr<ClientDescriptor<KEY, VALUE>>> ClientManager<KEY, VA auto iter = evicted.cbegin(); - // Remove evicted clients from list - mClients.erase(std::remove_if(mClients.begin(), mClients.end(), - [&iter] (std::shared_ptr<ClientDescriptor<KEY, VALUE>>& curClientPtr) { - if (curClientPtr->getKey() == (*iter)->getKey()) { - iter++; - return true; - } - return false; - }), mClients.end()); + if (iter != evicted.cend()) { + // Remove evicted clients from list + mClients.erase(std::remove_if(mClients.begin(), mClients.end(), + [&iter] (std::shared_ptr<ClientDescriptor<KEY, VALUE>>& curClientPtr) { + if (curClientPtr->getKey() == (*iter)->getKey()) { + iter++; + return true; + } + return false; + }), mClients.end()); + } mClients.push_back(client); mRemovedCondition.broadcast(); |