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 GitHub
parent 1e4a89177e
commit 2d3250923c
3 changed files with 4 additions and 8 deletions

View File

@@ -795,7 +795,7 @@ public:
/* Position scrollbar to selected group */
for (uint i = 0; i < this->rows; i++) {
if (this->groups[i]->index == sel) {
this->vscroll->SetPosition(Clamp(i - this->vscroll->GetCapacity() / 2, 0, std::max(this->vscroll->GetCount() - this->vscroll->GetCapacity(), 0)));
this->vscroll->SetPosition(i - this->vscroll->GetCapacity() / 2);
break;
}
}