« get me outta code hell

Don't crash when getting scrollSize - tui-lib - Pure Node.js library for making visual command-line programs (ala vim, ncdu)
about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2019-10-14 17:14:09 -0300
committerFlorrie <towerofnix@gmail.com>2019-10-14 17:14:09 -0300
commitc56242c3266d1fdf83eceed532c054fba8084630 (patch)
tree0754e1a209ab32cea6f800b71ff02c7b2d6a781f
parentfaab576e85baf787c44a67640282ba146a874ef5 (diff)
Don't crash when getting scrollSize
-rw-r--r--ui/form/ListScrollForm.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/ui/form/ListScrollForm.js b/ui/form/ListScrollForm.js
index 38fd2a2..78c376f 100644
--- a/ui/form/ListScrollForm.js
+++ b/ui/form/ListScrollForm.js
@@ -271,7 +271,7 @@ module.exports = class ListScrollForm extends Form {
     // past.
 
     let size = 0
-    for (let i = 0; i < this.scrollItems; i++) {
+    for (let i = 0; i < Math.min(this.scrollItems, this.inputs.length); i++) {
       if (this.layoutType === 'horizontal') {
         size += this.inputs[i].w
       } else {