From e47a3546f0f9244bb6ee3aa708e7e24226fbdad2 Mon Sep 17 00:00:00 2001 From: Florrie Date: Sat, 15 Dec 2018 01:31:52 -0400 Subject: Fix mistake in Form.addInput TL;DR afterIndex was not being set correctly. --- ui/DisplayElement.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'ui/DisplayElement.js') diff --git a/ui/DisplayElement.js b/ui/DisplayElement.js index 8a2aa71..9498487 100644 --- a/ui/DisplayElement.js +++ b/ui/DisplayElement.js @@ -87,7 +87,12 @@ module.exports = class DisplayElement extends EventEmitter { } child.parent = this - this.children.splice(afterIndex, 0, child) + + if (afterIndex === this.children.length) { + this.children.push(child) + } else { + this.children.splice(afterIndex, 0, child) + } if (fixLayout) { child.fixLayout() -- cgit 1.3.0-6-gf8a5