From 5ca7837f83be3c3ea1081db150ece49875fa61a0 Mon Sep 17 00:00:00 2001 From: Florrie Date: Tue, 12 Jun 2018 23:40:47 -0300 Subject: Be a little careful in Form.updateSelectedElement --- ui/form/Form.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/form/Form.js b/ui/form/Form.js index f1734ac..87763bb 100644 --- a/ui/form/Form.js +++ b/ui/form/Form.js @@ -71,7 +71,11 @@ module.exports = class Form extends FocusElement { } updateSelectedElement() { - if (this.root.select) { + if (this.root.select && this.inputs.length) { + if (this.curIndex > this.inputs.length - 1) { + this.curIndex = this.inputs.length - 1 + } + this.root.select(this.inputs[this.curIndex]) } } -- cgit 1.3.0-6-gf8a5