Merge pull request #17370 from hrydgard/scrollview-crash-fix

Fix ScrollView crash (though the root cause is a race condition most likely)
This commit is contained in:
Henrik Rydgård 2023-05-01 10:55:49 +02:00 committed by GitHub
commit d83ad5e601
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -203,6 +203,9 @@ bool ScrollView::Touch(const TouchInput &input) {
ScrollView::Bob ScrollView::ComputeBob() const {
Bob bob{};
if (views_.empty()) {
return bob;
}
float childHeight = std::max(0.01f, views_[0]->GetBounds().h);
float scrollMax = std::max(0.0f, childHeight - bounds_.h);
float ratio = bounds_.h / childHeight;