summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeterN <peter@fuzzle.org>2019-03-29 17:42:32 +0000
committerGitHub <noreply@github.com>2019-03-29 17:42:32 +0000
commit9244dad3f111b19950350f165dc2f61a62425f44 (patch)
tree9c4ae720d9b182ae4061ea465db13a2abe7edbee /src
parentacb09eb9a828a8da4243db4c26dd67b49993d063 (diff)
downloadopenttd-9244dad3f111b19950350f165dc2f61a62425f44.tar.xz
Fix #7434: Incorrect use of vector iterator. (#7437)
Diffstat (limited to 'src')
-rw-r--r--src/network/network_content_gui.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp
index 40f1966e4..b2e0dd795 100644
--- a/src/network/network_content_gui.cpp
+++ b/src/network/network_content_gui.cpp
@@ -636,9 +636,8 @@ public:
uint y = r.top;
auto iter = this->content.begin() + this->vscroll->GetPosition();
- auto end = iter + this->vscroll->GetCapacity();
- if (end > this->content.end())
- end = this->content.end();
+ size_t last = this->vscroll->GetPosition() + this->vscroll->GetCapacity();
+ auto end = (last < this->content.size()) ? this->content.begin() + last : this->content.end();
for (/**/; iter != end; iter++) {
const ContentInfo *ci = *iter;