From df0e9afe7aedd3dc6a1d0db72530a52e135af649 Mon Sep 17 00:00:00 2001 From: Florrie Date: Tue, 2 Apr 2019 08:12:52 -0300 Subject: 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. --- ui/form/ListScrollForm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/form') 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 } -- cgit 1.3.0-6-gf8a5