diff --git a/src/window_gui.h b/src/window_gui.h index 4a4750b43f..80819a9d32 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -287,7 +287,7 @@ public: void UpdatePosition(int difference) { if (difference == 0) return; - this->SetPosition(Clamp(this->pos + difference, 0, this->count - this->cap)); + this->SetPosition(Clamp(this->pos + difference, 0, max(this->count - this->cap, 0))); } /**