« get me outta code hell

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:
-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 {