Fix #10554: Let Scrollbar::SetPosition clamp instead of assert. (#10555)

This commit is contained in:
PeterN
2023-03-09 15:19:58 +00:00
committed by rubidium42
parent 4b40e93197
commit f16a1107d2
3 changed files with 4 additions and 8 deletions

View File

@@ -1114,9 +1114,7 @@ struct AIDebugWindow : public Window {
}
if (this->autoscroll) {
int scroll_pos = std::max(0, log->used - this->vscroll->GetCapacity());
if (scroll_pos != this->vscroll->GetPosition()) {
this->vscroll->SetPosition(scroll_pos);
if (this->vscroll->SetPosition(scroll_pos)) {
/* We need a repaint */
this->SetWidgetDirty(WID_AID_SCROLLBAR);
this->SetWidgetDirty(WID_AID_LOG_PANEL);