summaryrefslogtreecommitdiffstats
path: root/src/Chunk.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2015-09-19 21:03:45 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2015-09-19 21:03:45 +0200
commit7c884df26c335102da24dc7b6d015567bdf7d8a6 (patch)
tree0cf99c391d3145b18b9628e193ceb73760361aa9 /src/Chunk.cpp
parentMerge pull request #2484 from cuberite/clientPerformance (diff)
parentFixed wrong assumtion regarding RemoveClient (diff)
downloadcuberite-7c884df26c335102da24dc7b6d015567bdf7d8a6.tar
cuberite-7c884df26c335102da24dc7b6d015567bdf7d8a6.tar.gz
cuberite-7c884df26c335102da24dc7b6d015567bdf7d8a6.tar.bz2
cuberite-7c884df26c335102da24dc7b6d015567bdf7d8a6.tar.lz
cuberite-7c884df26c335102da24dc7b6d015567bdf7d8a6.tar.xz
cuberite-7c884df26c335102da24dc7b6d015567bdf7d8a6.tar.zst
cuberite-7c884df26c335102da24dc7b6d015567bdf7d8a6.zip
Diffstat (limited to 'src/Chunk.cpp')
-rw-r--r--src/Chunk.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index 6b061c53f..7a6938b77 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -1885,7 +1885,11 @@ bool cChunk::AddClient(cClientHandle * a_Client)
void cChunk::RemoveClient(cClientHandle * a_Client)
{
- m_LoadedByClient.erase(std::remove(m_LoadedByClient.begin(), m_LoadedByClient.end(), a_Client));
+ auto itr = std::remove(m_LoadedByClient.begin(), m_LoadedByClient.end(), a_Client);
+ // We should always remove at most one client.
+ ASSERT(std::distance(itr, m_LoadedByClient.end()) <= 1);
+ // Note: itr can equal m_LoadedByClient.end()
+ m_LoadedByClient.erase(itr, m_LoadedByClient.end());
if (!a_Client->IsDestroyed())
{