diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-06-19 22:31:21 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-06-19 22:31:21 +0200 |
commit | 602c2ec1b1dbd923b61113dfe9d6f6fffd619159 (patch) | |
tree | fd431c2cd3116075e64d11a7df16c48a80648b2f /source/cWorld.cpp | |
parent | Fixed a possible crash when restarting / stopping the server. (diff) | |
download | cuberite-602c2ec1b1dbd923b61113dfe9d6f6fffd619159.tar cuberite-602c2ec1b1dbd923b61113dfe9d6f6fffd619159.tar.gz cuberite-602c2ec1b1dbd923b61113dfe9d6f6fffd619159.tar.bz2 cuberite-602c2ec1b1dbd923b61113dfe9d6f6fffd619159.tar.lz cuberite-602c2ec1b1dbd923b61113dfe9d6f6fffd619159.tar.xz cuberite-602c2ec1b1dbd923b61113dfe9d6f6fffd619159.tar.zst cuberite-602c2ec1b1dbd923b61113dfe9d6f6fffd619159.zip |
Diffstat (limited to 'source/cWorld.cpp')
-rw-r--r-- | source/cWorld.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/cWorld.cpp b/source/cWorld.cpp index b9731d96c..e438760af 100644 --- a/source/cWorld.cpp +++ b/source/cWorld.cpp @@ -1515,8 +1515,9 @@ bool cWorld::ForEachPlayer(cPlayerListCallback & a_Callback) { // Calls the callback for each player in the list cCSLock Lock(m_CSPlayers); - for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + for (cPlayerList::iterator itr = m_Players.begin(), itr2 = itr; itr != m_Players.end(); itr = itr2) { + ++itr2; if (a_Callback.Item(*itr)) { return false; @@ -1658,8 +1659,9 @@ void cWorld::MoveEntityToChunk(cEntity * a_Entity, int a_ChunkX, int a_ChunkY, i bool cWorld::ForEachEntity(cEntityCallback & a_Callback) { cCSLock Lock(m_CSEntities); - for (cEntityList::iterator itr = m_AllEntities.begin(); itr != m_AllEntities.end(); ++itr ) + for (cEntityList::iterator itr = m_AllEntities.begin(), itr2 = itr; itr != m_AllEntities.end(); itr = itr2) { + ++itr2; if (a_Callback.Item(*itr)) { return false; |