diff options
author | Florrie <towerofnix@gmail.com> | 2019-04-02 08:12:52 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2019-04-02 08:12:52 -0300 |
commit | df0e9afe7aedd3dc6a1d0db72530a52e135af649 (patch) | |
tree | 296627e0008838d17428273ae03a02d3f210b43b /ui/form | |
parent | aa38d1beb78635e5273b89b76c6a2b91428dd62c (diff) |
Avoid crashing when scrolled past end of form
Usually this doesn't happen, but it may occur if the items of the ListScrollForm are regenerated (to a lesser length) before updating scrollItems.
Diffstat (limited to 'ui/form')
-rw-r--r-- | ui/form/ListScrollForm.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ui/form/ListScrollForm.js b/ui/form/ListScrollForm.js index 0e230b5..892f964 100644 --- a/ui/form/ListScrollForm.js +++ b/ui/form/ListScrollForm.js @@ -32,7 +32,7 @@ module.exports = class ListScrollForm extends Form { // we've scrolled, so we know right away that none of those will be // visible and we won't bother iterating over them. We do need to hide // them, though. - for (let i = 0; i < scrollItems; i++) { + for (let i = 0; i < Math.min(scrollItems, this.inputs.length); i++) { this.inputs[i].visible = false } |