summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;