From 9244dad3f111b19950350f165dc2f61a62425f44 Mon Sep 17 00:00:00 2001 From: PeterN Date: Fri, 29 Mar 2019 17:42:32 +0000 Subject: [PATCH] Fix #7434: Incorrect use of vector iterator. (#7437) --- src/network/network_content_gui.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp index 40f1966e4e..b2e0dd795f 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;