diff options
author | tycho <work.tycho@gmail.com> | 2015-09-19 18:22:57 +0200 |
---|---|---|
committer | tycho <work.tycho@gmail.com> | 2015-09-19 20:34:20 +0200 |
commit | a0519a487af7773178280c5638a9524e33356fae (patch) | |
tree | 0cf99c391d3145b18b9628e193ceb73760361aa9 /src/Chunk.cpp | |
parent | Merge pull request #2484 from cuberite/clientPerformance (diff) | |
download | cuberite-a0519a487af7773178280c5638a9524e33356fae.tar cuberite-a0519a487af7773178280c5638a9524e33356fae.tar.gz cuberite-a0519a487af7773178280c5638a9524e33356fae.tar.bz2 cuberite-a0519a487af7773178280c5638a9524e33356fae.tar.lz cuberite-a0519a487af7773178280c5638a9524e33356fae.tar.xz cuberite-a0519a487af7773178280c5638a9524e33356fae.tar.zst cuberite-a0519a487af7773178280c5638a9524e33356fae.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Chunk.cpp | 6 |
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()) { |