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:37:30 +02:00
parent d3a143ecb6
commit 838ef03815

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;