diff options
author | Ruben Brunk <rubenbrunk@google.com> | 2015-05-14 13:50:57 -0700 |
---|---|---|
committer | Ruben Brunk <rubenbrunk@google.com> | 2015-05-14 13:50:57 -0700 |
commit | 8050721de77a64c7b53467c5959f0ea38d80cab3 (patch) | |
tree | 66ffca37c75847be4e91d85b3f8c874743a7e0b1 /services/camera/libcameraservice/utils | |
parent | 804a77d1045c6c4023f73a0975a09025b2e8eef2 (diff) | |
download | frameworks_av-8050721de77a64c7b53467c5959f0ea38d80cab3.zip frameworks_av-8050721de77a64c7b53467c5959f0ea38d80cab3.tar.gz frameworks_av-8050721de77a64c7b53467c5959f0ea38d80cab3.tar.bz2 |
camera2: Fix empty set handling for eviction.
Bug: 20304829
Change-Id: I120ed6e41ca592c3770797a5fb1e5ce556543949
Diffstat (limited to 'services/camera/libcameraservice/utils')
-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(); |