diff options
author | rubidium <rubidium@openttd.org> | 2009-01-23 09:00:01 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-01-23 09:00:01 +0000 |
commit | fc5022d76ee23575d6b4cfb20e5f3a3aca6fd285 (patch) | |
tree | 35daebbffa46a9ed2773e00c612fac01a8206a61 | |
parent | f0ff90d71c2645a8f920ae94be34c3865d4308cf (diff) | |
download | openttd-fc5022d76ee23575d6b4cfb20e5f3a3aca6fd285.tar.xz |
(svn r15217) -Fix [FS#2573] (r15176): more corner cases when removing things from iterated vectors
-rw-r--r-- | src/network/network_content.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/network/network_content.cpp b/src/network/network_content.cpp index c0e097479..bdb3608ed 100644 --- a/src/network/network_content.cpp +++ b/src/network/network_content.cpp @@ -753,7 +753,7 @@ void ClientNetworkContentSocketHandler::OnConnect(bool success) for (ContentCallback **iter = this->callbacks.Begin(); iter != this->callbacks.End(); /* nothing */) { ContentCallback *cb = *iter; cb->OnConnect(success); - if (*iter == cb) iter++; + if (iter != this->callbacks.End() && *iter == cb) iter++; } } @@ -762,7 +762,7 @@ void ClientNetworkContentSocketHandler::OnDisconnect() for (ContentCallback **iter = this->callbacks.Begin(); iter != this->callbacks.End(); /* nothing */) { ContentCallback *cb = *iter; cb->OnDisconnect(); - if (*iter == cb) iter++; + if (iter != this->callbacks.End() && *iter == cb) iter++; } } @@ -771,7 +771,7 @@ void ClientNetworkContentSocketHandler::OnReceiveContentInfo(const ContentInfo * for (ContentCallback **iter = this->callbacks.Begin(); iter != this->callbacks.End(); /* nothing */) { ContentCallback *cb = *iter; cb->OnReceiveContentInfo(ci); - if (*iter == cb) iter++; + if (iter != this->callbacks.End() && *iter == cb) iter++; } } @@ -780,7 +780,7 @@ void ClientNetworkContentSocketHandler::OnDownloadProgress(const ContentInfo *ci for (ContentCallback **iter = this->callbacks.Begin(); iter != this->callbacks.End(); /* nothing */) { ContentCallback *cb = *iter; cb->OnDownloadProgress(ci, bytes); - if (*iter == cb) iter++; + if (iter != this->callbacks.End() && *iter == cb) iter++; } } @@ -794,7 +794,7 @@ void ClientNetworkContentSocketHandler::OnDownloadComplete(ContentID cid) for (ContentCallback **iter = this->callbacks.Begin(); iter != this->callbacks.End(); /* nothing */) { ContentCallback *cb = *iter; cb->OnDownloadComplete(cid); - if (*iter == cb) iter++; + if (iter != this->callbacks.End() && *iter == cb) iter++; } } |